sge::d3d9::vf::texture_coordinate_count const sge::d3d9::vf::texture_coordinates( sge::renderer::vf::dynamic::format const &_format ) { sge::d3d9::vf::texture_coordinate_count result( 0u ); sge::renderer::vf::dynamic::part_list const &parts( _format.parts() ); for( sge::renderer::vf::dynamic::part_list::const_iterator part_it( parts.begin() ); part_it != parts.end(); ++part_it ) { sge::renderer::vf::dynamic::ordered_element_list const &elements( part_it->elements() ); for( sge::renderer::vf::dynamic::ordered_element_list::const_iterator element_it( elements.begin() ); element_it != elements.end(); ++element_it ) if( fcppt::variant::holds_type< sge::renderer::vf::dynamic::texpos >( element_it->element().info() ) ) ++result; } return result; }
void mrn_get_partition_info(const char *table_name, uint table_name_length, const TABLE *table, partition_element **part_elem, partition_element **sub_elem) { char tmp_name[FN_LEN]; partition_info *part_info = table->part_info; partition_element *tmp_part_elem = NULL, *tmp_sub_elem = NULL; bool tmp_flg = FALSE, tmp_find_flg = FALSE; MRN_DBUG_ENTER_FUNCTION(); *part_elem = NULL; *sub_elem = NULL; if (!part_info) DBUG_VOID_RETURN; if (table_name && !memcmp(table_name + table_name_length - 5, "#TMP#", 5)) tmp_flg = TRUE; DBUG_PRINT("info", ("mroonga table_name=%s", table_name)); List_iterator<partition_element> part_it(part_info->partitions); while ((*part_elem = part_it++)) { if ((*part_elem)->subpartitions.elements) { List_iterator<partition_element> sub_it((*part_elem)->subpartitions); while ((*sub_elem = sub_it++)) { create_subpartition_name(tmp_name, table->s->path.str, (*part_elem)->partition_name, (*sub_elem)->partition_name, NORMAL_PART_NAME); DBUG_PRINT("info", ("mroonga tmp_name=%s", tmp_name)); if (table_name && !memcmp(table_name, tmp_name, table_name_length + 1)) DBUG_VOID_RETURN; if ( tmp_flg && table_name && *(tmp_name + table_name_length - 5) == '\0' && !memcmp(table_name, tmp_name, table_name_length - 5) ) { tmp_part_elem = *part_elem; tmp_sub_elem = *sub_elem; tmp_flg = FALSE; tmp_find_flg = TRUE; } } } else { create_partition_name(tmp_name, table->s->path.str, (*part_elem)->partition_name, NORMAL_PART_NAME, TRUE); DBUG_PRINT("info", ("mroonga tmp_name=%s", tmp_name)); if (table_name && !memcmp(table_name, tmp_name, table_name_length + 1)) DBUG_VOID_RETURN; if ( tmp_flg && table_name && *(tmp_name + table_name_length - 5) == '\0' && !memcmp(table_name, tmp_name, table_name_length - 5) ) { tmp_part_elem = *part_elem; tmp_flg = FALSE; tmp_find_flg = TRUE; } } } if (tmp_find_flg) { *part_elem = tmp_part_elem; *sub_elem = tmp_sub_elem; DBUG_PRINT("info", ("mroonga tmp find")); DBUG_VOID_RETURN; } *part_elem = NULL; *sub_elem = NULL; DBUG_PRINT("info", ("mroonga no hit")); DBUG_VOID_RETURN; }
// Attempt to improve this by adding partitions or expanding partitions. void ColPartitionSet::ImproveColumnCandidate(WidthCallback* cb, PartSetVector* src_sets) { int set_size = src_sets->size(); // Iterate over the provided column sets, as each one may have something // to improve this. for (int i = 0; i < set_size; ++i) { ColPartitionSet* column_set = src_sets->get(i); if (column_set == NULL) continue; // Iterate over the parts in this and column_set, adding bigger or // new parts in column_set to this. ColPartition_IT part_it(&parts_); ASSERT_HOST(!part_it.empty()); int prev_right = MIN_INT32; part_it.mark_cycle_pt(); ColPartition_IT col_it(&column_set->parts_); for (col_it.mark_cycle_pt(); !col_it.cycled_list(); col_it.forward()) { ColPartition* col_part = col_it.data(); if (col_part->blob_type() < BRT_UNKNOWN) continue; // Ignore image partitions. int col_left = col_part->left_key(); int col_right = col_part->right_key(); // Sync-up part_it (in this) so it matches the col_part in column_set. ColPartition* part = part_it.data(); while (!part_it.at_last() && part->right_key() < col_left) { prev_right = part->right_key(); part_it.forward(); part = part_it.data(); } int part_left = part->left_key(); int part_right = part->right_key(); if (part_right < col_left || col_right < part_left) { // There is no overlap so this is a new partition. AddPartition(col_part->ShallowCopy(), &part_it); continue; } // Check the edges of col_part to see if they can improve part. bool part_width_ok = cb->Run(part->KeyWidth(part_left, part_right)); if (col_left < part_left && col_left > prev_right) { // The left edge of the column is better and it doesn't overlap, // so we can potentially expand it. int col_box_left = col_part->BoxLeftKey(); bool tab_width_ok = cb->Run(part->KeyWidth(col_left, part_right)); bool box_width_ok = cb->Run(part->KeyWidth(col_box_left, part_right)); if (tab_width_ok || (!part_width_ok )) { // The tab is leaving the good column metric at least as good as // it was before, so use the tab. part->CopyLeftTab(*col_part, false); part->SetColumnGoodness(cb); } else if (col_box_left < part_left && (box_width_ok || !part_width_ok)) { // The box is leaving the good column metric at least as good as // it was before, so use the box. part->CopyLeftTab(*col_part, true); part->SetColumnGoodness(cb); } part_left = part->left_key(); } if (col_right > part_right && (part_it.at_last() || part_it.data_relative(1)->left_key() > col_right)) { // The right edge is better, so we can possibly expand it. int col_box_right = col_part->BoxRightKey(); bool tab_width_ok = cb->Run(part->KeyWidth(part_left, col_right)); bool box_width_ok = cb->Run(part->KeyWidth(part_left, col_box_right)); if (tab_width_ok || (!part_width_ok )) { // The tab is leaving the good column metric at least as good as // it was before, so use the tab. part->CopyRightTab(*col_part, false); part->SetColumnGoodness(cb); } else if (col_box_right > part_right && (box_width_ok || !part_width_ok)) { // The box is leaving the good column metric at least as good as // it was before, so use the box. part->CopyRightTab(*col_part, true); part->SetColumnGoodness(cb); } } } } ComputeCoverage(); }