const SkPaint* CanvasRenderingContext2DState::getPaint( PaintType paintType, ShadowMode shadowMode, ImageType imageType) const { SkPaint* paint; switch (paintType) { case StrokePaintType: updateLineDash(); updateStrokeStyle(); paint = &m_strokePaint; break; default: ASSERT_NOT_REACHED(); // no break on purpose: paint needs to be assigned to avoid compiler warning // about uninitialized variable. case FillPaintType: updateFillStyle(); paint = &m_fillPaint; break; case ImagePaintType: paint = &m_imagePaint; break; } if ((!shouldDrawShadows() && shadowMode == DrawShadowAndForeground) || shadowMode == DrawForegroundOnly) { paint->setLooper(0); paint->setImageFilter(0); return paint; } if (!shouldDrawShadows() && shadowMode == DrawShadowOnly) { paint->setLooper(sk_ref_sp(emptyDrawLooper())); // draw nothing paint->setImageFilter(0); return paint; } if (shadowMode == DrawShadowOnly) { if (imageType == NonOpaqueImage || m_filterValue) { paint->setLooper(0); paint->setImageFilter(shadowOnlyImageFilter()); return paint; } paint->setLooper(sk_ref_sp(shadowOnlyDrawLooper())); paint->setImageFilter(0); return paint; } ASSERT(shadowMode == DrawShadowAndForeground); if (imageType == NonOpaqueImage) { paint->setLooper(0); paint->setImageFilter(shadowAndForegroundImageFilter()); return paint; } paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); paint->setImageFilter(0); return paint; }
void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) { double *ctm = getDefCTM(); updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateLineWidth(state); }
//! Change back to the old state void restoreState(GfxState *state) { g_print ("restoreState\n"); // should contain all of our update*() methods? updateLineWidth(state); updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateStrokeColor(state); updateStrokeOpacity(state); updateFillColor(state); updateFillOpacity(state); updateFont(state); }
//! Change back to the old state void restoreState(GfxState *state) { // just restore the matrix for now this->matrices.pop_back(); this->matrix = this->matrices.back(); // should contain all of our update*() methods? updateLineWidth(state); updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateStrokeColor(state); updateStrokeOpacity(state); updateFillColor(state); updateFillOpacity(state); updateFont(state); }
void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) { DiaMatrix mat; mat.xx = m11; mat.yx = m12; mat.xy = m21; mat.yy = m22; mat.x0 = m31 * scale; mat.y0 = m32 * scale; //this->matrix = mat; dia_matrix_multiply (&this->matrix, &mat, &this->matrix); updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateLineWidth(state); }