HRESULT D2DRenderer::Draw(HDC hdc) { HRESULT hr = DrawInternal(); // If D2D returns D2DERR_RECREATE_TARGET, the client should recreate // the render target and try rendering the entire frame again. if (hr == D2DERR_RECREATE_TARGET) { FreeDeviceDependentResources(); hr = DrawInternal(); } return hr; }
void AirspaceLabelRenderer::Draw(Canvas &canvas, #ifndef ENABLE_OPENGL Canvas &stencil_canvas, #endif const WindowProjection &projection, const MoreData &basic, const DerivedInfo &calculated, const AirspaceComputerSettings &computer_settings, const AirspaceRendererSettings &settings) { if (airspaces == nullptr || airspaces->IsEmpty()) return; AirspaceWarningCopy awc; if (warning_manager != nullptr) awc.Visit(*warning_manager); const AircraftState aircraft = ToAircraftState(basic, calculated); const AirspaceMapVisible visible(computer_settings, settings, aircraft, awc); DrawInternal(canvas, #ifndef ENABLE_OPENGL stencil_canvas, #endif projection, settings, awc, visible, computer_settings.warnings); }
void ImageBase::Draw(HDC hdc, RECT& rc, bool clip) { HRGN hrgn = NULL; if (clip) { hrgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom); SelectClipRgn(hdc, hrgn); } SIZE iSize; GetSize(iSize); const int sizeX = rc.right - rc.left; const int sizeY = rc.bottom - rc.top; const int x = rc.left + (sizeX > iSize.cx || clip ? (sizeX - iSize.cx) / 2 : 0); const int y = rc.top + (sizeY > iSize.cy || clip ? (sizeY - iSize.cy) / 2 : 0); const int scaleX = sizeX > iSize.cx || clip ? iSize.cx : sizeX; const int scaleY = sizeY > iSize.cy || clip ? iSize.cy : sizeY; DrawInternal(hdc, x, y, scaleX, scaleY); if (clip) { SelectClipRgn(hdc, NULL); DeleteObject(hrgn); } }
void RenderingContext::Draw( const std::shared_ptr<IMesh>& mesh ) { if ( mesh == nullptr ) { return; } RenderingDevice* pDevice = RenderingDevice::GetInstance(); Assert( pDevice ); Assert( m_inputAssembler ); Assert( m_vertexShader ); Assert( m_rasterizer ); Assert( m_pixelShader ); Assert( m_outputMerger ); // Set a constant buffer for WVP transform. ConstantBuffer& cbuffer = GetSharedConstantBuffer(); const Matrix4& w = cbuffer.GetMatrix4( ConstantBuffer::WorldMatrix ); Matrix4 wv = w * pDevice->GetViewMatrix(); Matrix4 wvp = wv * pDevice->GetProjectionMatrix(); cbuffer.SetMatrix4( ConstantBuffer::WVPMatrix, wvp ); // Draw primitives here. if ( mesh->GetPrimitiveType() == PrimitiveType::Undefined ) { if ( const IrregularMesh* pMesh = dynamic_cast< const IrregularMesh* >( mesh.get() ) ) { for ( size_t face = 0; face < pMesh->NumFaces(); ++face ) { const unsigned char* color = pMesh->GetFaceColor( face ); cbuffer.SetVector4( ConstantBuffer::DiffuseColor, Vector4( static_cast<byte>( color[0] / 255.0f ), static_cast<byte>( color[1] / 255.0f ), static_cast<byte>( color[2] / 255.0f ), static_cast<byte>( color[3] / 255.0f ) ) ); m_inputAssembler->SetFaceIndex( face ); SetCullMode( CullMode::None ); DrawInternal( mesh, GetPrimitiveTypeFromNumberOfVertices( pMesh->NumVerticesInFace( face ) ) ); } } } else { SetCullMode( CullMode::CCW ); DrawInternal( mesh ); } }
void CMeshOES2::Draw(CPrimList *pLists, int nLists) { if (!(ShaderUtil()->OnDrawMesh(this, pLists, nLists))) { MarkAsDrawn(); return; } DrawInternal(pLists, nLists); }
void Critter::Draw() const { ofPushMatrix(); ofTranslate(position); ofRotate(ofRadToDeg(orientation)); ofPushStyle(); if (food > 0) { ofEnableAlphaBlending(); ofColor interior = interior_cell_color().getLerped(wall_cell_color(), (radius() - 10) / 10.0); ofSetColor(interior, 255 * food); ofFill(); ofSetLineWidth(0); DrawInternal(); ofDisableAlphaBlending(); } ofColor membrane = membrane_color(); membrane.setSaturation(255 * (1 - age * age * age)); ofSetColor(membrane / (21.0 / radius())); ofNoFill(); ofSetLineWidth(area * kLineWidthScaleFactor); DrawInternal(); ofPopStyle(); ofPopMatrix(); }
void AirspaceRenderer::Draw(Canvas &canvas, #ifndef ENABLE_OPENGL Canvas &stencil_canvas, #endif const WindowProjection &projection, const AirspaceRendererSettings &settings, const AirspaceWarningCopy &awc, const AirspacePredicate &visible) { if (airspaces == nullptr || airspaces->IsEmpty()) return; DrawInternal(canvas, #ifndef ENABLE_OPENGL stencil_canvas, #endif projection, settings, awc, visible); intersections = awc.GetLocations(); }
void CMeshOES2::Draw(int nFirstIndex, int nIndexCount) { if (!(ShaderUtil()->OnDrawMesh(this, nFirstIndex, nIndexCount))) { MarkAsDrawn(); return; } CPrimList primList; if (!nIndexCount || (nFirstIndex == -1)) { primList.m_FirstIndex = 0; primList.m_NumIndices = m_NumIndices; } else { primList.m_FirstIndex = nFirstIndex; primList.m_NumIndices = nIndexCount; } DrawInternal(&primList, 1); }
//------------------------------------------------------------------------------ void TreeDrawer::Draw () { NodeIterator <Node> n (t->GetRoot()); Node *q = n.begin(); while (q) { if (q->IsLeaf ()) { DrawLeaf (q); } else { DrawInternal (q); } q = n.next(); } if (rooted) { DrawRoot (); } }
RasterImage::Draw(gfxContext* aContext, const IntSize& aSize, const ImageRegion& aRegion, uint32_t aWhichFrame, SamplingFilter aSamplingFilter, const Maybe<SVGImageContext>& /*aSVGContext - ignored*/, uint32_t aFlags) { if (aWhichFrame > FRAME_MAX_VALUE) { return DrawResult::BAD_ARGS; } if (mError) { return DrawResult::BAD_IMAGE; } // Illegal -- you can't draw with non-default decode flags. // (Disabling colorspace conversion might make sense to allow, but // we don't currently.) if (ToSurfaceFlags(aFlags) != DefaultSurfaceFlags()) { return DrawResult::BAD_ARGS; } if (!aContext) { return DrawResult::BAD_ARGS; } if (IsUnlocked() && mProgressTracker) { mProgressTracker->OnUnlockedDraw(); } // If we're not using SamplingFilter::GOOD, we shouldn't high-quality scale or // downscale during decode. uint32_t flags = aSamplingFilter == SamplingFilter::GOOD ? aFlags : aFlags & ~FLAG_HIGH_QUALITY_SCALING; DrawableSurface surface = LookupFrame(aSize, flags, ToPlaybackType(aWhichFrame)); if (!surface) { // Getting the frame (above) touches the image and kicks off decoding. if (mDrawStartTime.IsNull()) { mDrawStartTime = TimeStamp::Now(); } return DrawResult::NOT_READY; } bool shouldRecordTelemetry = !mDrawStartTime.IsNull() && surface->IsFinished(); auto result = DrawInternal(Move(surface), aContext, aSize, aRegion, aSamplingFilter, flags); if (shouldRecordTelemetry) { TimeDuration drawLatency = TimeStamp::Now() - mDrawStartTime; Telemetry::Accumulate(Telemetry::IMAGE_DECODE_ON_DRAW_LATENCY, int32_t(drawLatency.ToMicroseconds())); mDrawStartTime = TimeStamp(); } return result; }
void MLIFont::Draw(const string &s, Vector2 position, Color color, RectangleWH clipRect, double scale) { DrawInternal(s, position, color, scale, clipRect); }
void MLIFont::Draw(const string &s, Vector2 position, Color color, RectangleWH clipRect) { DrawInternal(s, position, color, 1.0, clipRect); }
void MLIFont::Draw(const string &s, Vector2 position, Color color, double scale) { DrawInternal(s, position, color, scale, RectangleWH(0, 0, -1, -1)); }
void MLIFont::Draw(const string &s, Vector2 position, Color color) { DrawInternal(s, position, color, 1.0, RectangleWH(0, 0, -1, -1)); }