int CMiniCalendarCtrl::GetMinWidth() { if (!m_bSizeComputed) ComputeSize(); return m_szMonthSize.cx; }
void TextLayout::Draw(const Point &maxArea) { ComputeSize(maxArea); for (std::vector<Word>::iterator i = m_words.begin(); i != m_words.end(); ++i) m_font->RenderString((*i).text.c_str(), (*i).pos.x, (*i).pos.y, Color::WHITE); }
//----------------------------------------------------------------------------- void Region::ComputeDimension( Region &anchor, int set ) { int ip = set * 3; // index base for points and anchor_points int ir = set * 2; // index base for ? if( m_points[ip].set && m_points[ip+2].set ) { // left and right set, compute from points m_computed_rect[0+set] = ComputePoint( anchor, m_anchor_points[ip], set, m_points[ip] ); m_computed_rect[2+set] = ComputePoint( anchor, m_anchor_points[ip+2], set, m_points[ip] ); } else if( m_points[ip+1].set && m_size[set].set ) { // center set, compute from size int pos = ComputePoint( anchor, m_anchor_points[ip+1], set, m_points[ip+1] ); int size = ComputeSize( anchor, set ); m_computed_rect[0+set] = pos - size / 2; m_computed_rect[2+set] = m_computed_rect[0+set] + size; } else if( m_points[ip].set && m_size[set].set ) { m_computed_rect[0+set] = ComputePoint( anchor, m_anchor_points[ip], set, m_points[ip] ); m_computed_rect[2+set] = m_computed_rect[0+set] + ComputeSize( anchor, set ); } else if( m_points[ip+2].set && m_size[set].set ) { m_computed_rect[2+set] = ComputePoint( anchor, m_anchor_points[ip], set, m_points[ip] ); m_computed_rect[0+set] = m_computed_rect[2+set] - ComputeSize( anchor, set ); } else { // not enough data to compute. return; } m_computed_size[set] = m_computed_rect[2+set] - m_computed_rect[0+set]; }
virtual void State(int reason) { if(reason == OPEN) { ComputeSize(); ready = true; } }
gfxQuartzImageSurface::gfxQuartzImageSurface(gfxImageSurface *imageSurface) { if (imageSurface->CairoSurface() == nullptr) return; cairo_surface_t *surf = cairo_quartz_image_surface_create (imageSurface->CairoSurface()); Init (surf); mSize = ComputeSize(); }
bool CertificateDataBlock::Serialize( WONCommon::RawBuffer &theRawBuf ) const { unsigned short aDataTag = GetContentType(); theRawBuf.append(reinterpret_cast<const unsigned char*>(&aDataTag), sizeof(aDataTag)); unsigned short aDataLength = ComputeSize(); theRawBuf.append(reinterpret_cast<const unsigned char*>(&aDataLength), sizeof(aDataLength)); return true; }
/*---------------------------------------------------------------------- | AP4_TfhdAtom::Create +---------------------------------------------------------------------*/ AP4_TfhdAtom* AP4_TfhdAtom::Create(AP4_Size size, AP4_ByteStream& stream) { AP4_UI08 version; AP4_UI32 flags; if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL; if (version > 0) return NULL; if (size < ComputeSize(flags)) return NULL; return new AP4_TfhdAtom(size, version, flags, stream); }
void MeterWidget::AdjustSizePos() { QPoint p; if (m_container->windowFlags() & Qt::Window) p = m_container->pos(); else p = m_container->mapToGlobal(m_container->pos()); ComputeSize(); m_PosX = p.x() + m_container->width() * m_RelativePosX - m_Width/2; m_PosY = p.y() + m_container->height() * m_RelativePosY - m_Height/2; move(m_PosX, m_PosY); adjustSize(); }
/*---------------------------------------------------------------------- | AP4_TfhdAtom::AP4_TfhdAtom +---------------------------------------------------------------------*/ AP4_TfhdAtom::AP4_TfhdAtom(AP4_UI32 flags, AP4_UI32 track_id, AP4_UI64 base_data_offset, AP4_UI32 sample_description_index, AP4_UI32 default_sample_duration, AP4_UI32 default_sample_size, AP4_UI32 default_sample_flags) : AP4_Atom(AP4_ATOM_TYPE_TFHD, ComputeSize(flags), 0, flags), m_TrackId(track_id), m_BaseDataOffset(base_data_offset), m_SampleDescriptionIndex(sample_description_index), m_DefaultSampleDuration(default_sample_duration), m_DefaultSampleSize(default_sample_size), m_DefaultSampleFlags(default_sample_flags) { }
///////////////////////////////////////////////////////////////////////////// // CMiniCalendarCtrl message handlers // void CMiniCalendarCtrl::OnPaint() { CPaintDC dc(this); // device context for painting CMemDC dcDraw(&dc); if (!m_bSizeComputed) ComputeSize(); CRect rcClient; GetClientRect(rcClient); dcDraw.FillSolidRect(0, 0, rcClient.Width(), rcClient.Height(), m_cBackColor); int iY = 0; int iMonth = m_iCurrentMonth; int iYear = m_iCurrentYear; // draw each row individually for (int iRow = 1; iRow <= m_iRows; iRow++) { int iCurrentX = 0; int iCurrentY = iY; iCurrentY += DrawHeader(dcDraw, iCurrentY, iCurrentX, iRow, iMonth, iYear); iCurrentY += DrawDaysOfWeek(dcDraw, iCurrentY, iCurrentX, iRow); iCurrentY += DrawDays(dcDraw, iCurrentY, iCurrentX, iRow, iMonth, iYear); iCurrentX += m_szMonthSize.cx; iMonth++; if (iMonth > 12) { iMonth = 1; iYear++; } iY += m_szMonthSize.cy; } }
ComputeSize ComputeSize::Default2D() { return ComputeSize(glm::ivec2{1}); }
// determine total size of control (all rows/cols + border) CSize CMiniCalendarCtrl::ComputeTotalSize() { CSize size = ComputeSize(); size.cy *= m_iRows; return size; }
gfxQuartzImageSurface::gfxQuartzImageSurface(cairo_surface_t *csurf) { Init (csurf, true); mSize = ComputeSize(); }
virtual void Layout() { if(ready) ComputeSize(); }
ComputeSize ComputeSize::Default1D() { return ComputeSize(1); }
void DrawTree::PrepareDrawing() { ComputeSize(); ComputeDepth(); }
void nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock, nsCSSCompressedDataBlock **aImportantBlock) { nsAutoPtr<nsCSSCompressedDataBlock> result_normal, result_important; char *cursor_normal, *cursor_important; ComputeSizeResult size = ComputeSize(); result_normal = new(size.normal) nsCSSCompressedDataBlock(); cursor_normal = result_normal->Block(); if (size.important != 0) { result_important = new(size.important) nsCSSCompressedDataBlock(); cursor_important = result_important->Block(); } else { result_important = nsnull; cursor_important = nsnull; } /* * Save needless copying and allocation by copying the memory * corresponding to the stored data in the expanded block, and then * clearing the data in the expanded block. */ for (size_t iHigh = 0; iHigh < nsCSSPropertySet::kChunkCount; ++iHigh) { if (!mPropertiesSet.HasPropertyInChunk(iHigh)) continue; for (size_t iLow = 0; iLow < nsCSSPropertySet::kBitsInChunk; ++iLow) { if (!mPropertiesSet.HasPropertyAt(iHigh, iLow)) continue; nsCSSProperty iProp = nsCSSPropertySet::CSSPropertyAt(iHigh, iLow); NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(iProp), "out of range"); bool important = mPropertiesImportant.HasPropertyAt(iHigh, iLow); char *&cursor = important ? cursor_important : cursor_normal; nsCSSCompressedDataBlock *result = important ? result_important : result_normal; nsCSSValue* val = PropertyAt(iProp); NS_ABORT_IF_FALSE(val->GetUnit() != eCSSUnit_Null, "Null value while compressing"); CDBValueStorage *storage = reinterpret_cast<CDBValueStorage*>(cursor); storage->property = iProp; memcpy(&storage->value, val, sizeof(nsCSSValue)); new (val) nsCSSValue(); cursor += CDBValueStorage_advance; result->mStyleBits |= nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[iProp]); } } result_normal->SetBlockEnd(cursor_normal); NS_ABORT_IF_FALSE(result_normal->DataSize() == ptrdiff_t(size.normal), "size miscalculation"); if (result_important) { result_important->SetBlockEnd(cursor_important); NS_ABORT_IF_FALSE(result_important->DataSize() == ptrdiff_t(size.important), "size miscalculation"); } ClearSets(); AssertInitialState(); *aNormalBlock = result_normal.forget(); *aImportantBlock = result_important.forget(); }