Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1923)

Unified Diff: Source/platform/graphics/GraphicsContext.h

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/GraphicsContext.h
diff --git a/Source/platform/graphics/GraphicsContext.h b/Source/platform/graphics/GraphicsContext.h
index 8fdd3211f92bb91f358d9354795dab11d97daafa..be6110949784955380a7f80b0fc991ceddb783bd 100644
--- a/Source/platform/graphics/GraphicsContext.h
+++ b/Source/platform/graphics/GraphicsContext.h
@@ -149,19 +149,9 @@ public:
void disableAntialiasingOptimizationForHairlineImages() { ASSERT(!isRecording()); m_antialiasHairlineImages = true; }
bool shouldAntialiasHairlineImages() const { return m_antialiasHairlineImages; }
- void setShouldClampToSourceRect(bool clampToSourceRect) { mutableState()->setShouldClampToSourceRect(clampToSourceRect); }
- bool shouldClampToSourceRect() const { return immutableState()->shouldClampToSourceRect(); }
-
void setTextDrawingMode(TextDrawingModeFlags mode) { mutableState()->setTextDrawingMode(mode); }
TextDrawingModeFlags textDrawingMode() const { return immutableState()->textDrawingMode(); }
- void setAlphaAsFloat(float alpha) { mutableState()->setAlphaAsFloat(alpha);}
- int getNormalizedAlpha() const
- {
- int alpha = immutableState()->alpha();
- return alpha > 255 ? 255 : alpha;
- }
-
void setImageInterpolationQuality(InterpolationQuality quality) { mutableState()->setInterpolationQuality(quality); }
InterpolationQuality imageInterpolationQuality() const { return immutableState()->interpolationQuality(); }
@@ -233,7 +223,6 @@ public:
// These methods write to the canvas.
// Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRoundedRect
void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, int x, int y);
- void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint* = 0);
void drawOval(const SkRect&, const SkPaint&);
void drawPath(const SkPath&, const SkPaint&);
void drawRect(const SkRect&, const SkPaint&);
@@ -278,14 +267,11 @@ public:
void setShadow(const FloatSize& offset, float blur, const Color&,
DrawLooperBuilder::ShadowTransformMode = DrawLooperBuilder::ShadowRespectsTransforms,
DrawLooperBuilder::ShadowAlphaMode = DrawLooperBuilder::ShadowRespectsAlpha, ShadowMode = DrawShadowAndForeground);
- void clearShadow() { clearDrawLooper(); clearDropShadowImageFilter(); }
- void setDropShadowImageFilter(PassRefPtr<SkImageFilter>);
// It is assumed that this draw looper is used only for shadows
// (i.e. a draw looper is set if and only if there is a shadow).
// The builder passed into this method will be destroyed.
void setDrawLooper(PassOwnPtr<DrawLooperBuilder>);
- void setDrawLooper(PassRefPtr<SkDrawLooper> looper) { mutableState()->setDrawLooper(looper); }
void clearDrawLooper();
void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&);
@@ -301,6 +287,8 @@ public:
typedef unsigned Edges;
void drawInnerShadow(const FloatRoundedRect&, const Color& shadowColor, const IntSize shadowOffset, int shadowBlur, int shadowSpread, Edges clippedEdges = NoEdge);
+ const SkPaint& fillPaint() const { return immutableState()->fillPaint(); }
+
// ---------- Transformation methods -----------------
// Note that the getCTM method returns only the current transform from Blink's perspective,
// which is not the final transform used to place content on screen. It cannot be relied upon
@@ -315,6 +303,9 @@ public:
void translate(float x, float y);
// ---------- End transformation methods -----------------
+ void preparePaintForImage(SkPaint*) const;
+ SkFilterQuality getFilterQuality(Image*, const FloatRect& dest, const FloatRect& src) const;
+
// URL drawing
void setURLForRect(const KURL&, const IntRect&);
void setURLFragmentForRect(const String& name, const IntRect&);
@@ -325,17 +316,6 @@ public:
void beginAnnotation(const AnnotationList&);
void endAnnotation();
- // This method can potentially push saves onto the canvas. It returns the initial save count,
- // and should be balanced with a call to context->canvas()->restoreToCount(initialSaveCount).
- WARN_UNUSED_RETURN int preparePaintForDrawRectToRect(
- SkPaint*,
- const SkRect& srcRect,
- const SkRect& destRect,
- SkXfermode::Mode,
- bool isBitmapWithAlpha,
- bool isLazyDecoded = false,
- bool isDataComplete = true) const;
-
static int focusRingOutsetExtent(int offset, int width)
{
return focusRingOutset(offset) + (focusRingWidth(width) + 1) / 2;
@@ -392,9 +372,6 @@ private:
void concat(const SkMatrix&);
void drawRRect(const SkRRect&, const SkPaint&);
- void clearDropShadowImageFilter();
- SkImageFilter* dropShadowImageFilter() const { return immutableState()->dropShadowImageFilter(); }
-
// Apply deferred paint state saves
void realizePaintSave()
{

Powered by Google App Engine
This is Rietveld 408576698