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

Side by Side Diff: include/utils/SkPaintFilterCanvas.h

Issue 1032173002: Add a paint filter utility canvas (SkPaintFilterCanvas) (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkPaintFilterCanvas_DEFINED
9 #define SkPaintFilterCanvas_DEFINED
10
11 #include "SkNWayCanvas.h"
12
13 /** \class SkPaintFilterCanvas
14
15 A utility proxy base class for implementing paint filters.
16 */
17 class SK_API SkPaintFilterCanvas : public SkNWayCanvas {
18 public:
19 SkPaintFilterCanvas(int width, int height);
20
21 enum Type {
22 kPaint_Type,
23 kPoint_Type,
24 kBitmap_Type,
25 kRect_Type,
26 kRRect_Type,
27 kOval_Type,
28 kPath_Type,
29 kPicture_Type,
30 kText_Type,
31 kTextBlob_Type,
32
33 kTypeCount
34 };
35
36 protected:
37 /**
38 * Called with the paint that will be used to draw the specified type.
39 * The implementation may modify the paint as they wish.
40 *
41 * Note: The base implementation calls filterPaint() for top-level/explicit paints only.
42 * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), c lients may need to
43 * override the relevant methods (i.e. drawPicture, drawTextBlob).
44 */
45 virtual void filterPaint(SkPaint* paint, Type type) const = 0;
46
robertphillips 2015/03/25 15:07:06 Are we now using "override" instead of "SK_OVERRID
f(malita) 2015/03/25 15:29:22 That's the word in this corner of the room :) (mt
mtklein 2015/03/25 15:39:17 Yes, I am trying to upload the mega s/SK_OVERRIDE/
47 void onDrawPaint(const SkPaint&) override;
48 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override;
49 void onDrawRect(const SkRect&, const SkPaint&) override;
50 void onDrawRRect(const SkRRect&, const SkPaint&) override;
51 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
52 void onDrawOval(const SkRect&, const SkPaint&) override;
53 void onDrawPath(const SkPath&, const SkPaint&) override;
54 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override;
55 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
56 DrawBitmapRectFlags flags) override;
57 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint* ) override;
58 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
59 const SkPaint*) override;
60 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
61 const SkPaint*) override;
62 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) overri de;
63 void onDrawVertices(VertexMode vmode, int vertexCount,
64 const SkPoint vertices[], const SkPoint texs[],
65 const SkColor colors[], SkXfermode* xmode,
66 const uint16_t indices[], int indexCount,
67 const SkPaint&) override;
68 void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
69 const SkPoint texCoords[4], SkXfermode* xmode,
70 const SkPaint& paint) override;
71 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri de;
72
73 void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
74 const SkPaint&) override;
75 void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
76 const SkPaint&) override;
77 void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos [],
78 SkScalar constY, const SkPaint&) override;
79 void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& pat h,
80 const SkMatrix* matrix, const SkPaint&) override;
81 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
82 const SkPaint& paint) override;
83
84 private:
85 class AutoPaintFilter;
86
87 typedef SkNWayCanvas INHERITED;
88 };
89
90 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698