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

Side by Side Diff: cc/paint/paint_canvas.h

Issue 2743363006: Clean up cc/paint interfaces (Closed)
Patch Set: Fix PaintControllerTest v2 Created 3 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
« no previous file with comments | « cc/layers/picture_image_layer.cc ('k') | cc/paint/paint_recorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_PAINT_PAINT_CANVAS_H_ 5 #ifndef CC_PAINT_PAINT_CANVAS_H_
6 #define CC_PAINT_PAINT_CANVAS_H_ 6 #define CC_PAINT_PAINT_CANVAS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 virtual int save() = 0; 46 virtual int save() = 0;
47 virtual int saveLayer(const SkRect* bounds, const PaintFlags* flags) = 0; 47 virtual int saveLayer(const SkRect* bounds, const PaintFlags* flags) = 0;
48 virtual int saveLayerAlpha(const SkRect* bounds, U8CPU alpha) = 0; 48 virtual int saveLayerAlpha(const SkRect* bounds, U8CPU alpha) = 0;
49 49
50 virtual void restore() = 0; 50 virtual void restore() = 0;
51 virtual int getSaveCount() const = 0; 51 virtual int getSaveCount() const = 0;
52 virtual void restoreToCount(int save_count) = 0; 52 virtual void restoreToCount(int save_count) = 0;
53 virtual void translate(SkScalar dx, SkScalar dy) = 0; 53 virtual void translate(SkScalar dx, SkScalar dy) = 0;
54 virtual void scale(SkScalar sx, SkScalar sy) = 0; 54 virtual void scale(SkScalar sx, SkScalar sy) = 0;
55 virtual void rotate(SkScalar degrees) = 0; 55 virtual void rotate(SkScalar degrees) = 0;
56 virtual void rotate(SkScalar degrees, SkScalar px, SkScalar py) = 0;
57 virtual void concat(const SkMatrix& matrix) = 0; 56 virtual void concat(const SkMatrix& matrix) = 0;
58 virtual void setMatrix(const SkMatrix& matrix) = 0; 57 virtual void setMatrix(const SkMatrix& matrix) = 0;
59 virtual void resetMatrix() = 0;
60 58
61 virtual void clipRect(const SkRect& rect, 59 virtual void clipRect(const SkRect& rect,
62 SkClipOp op, 60 SkClipOp op,
63 bool do_anti_alias) = 0; 61 bool do_anti_alias) = 0;
64 void clipRect(const SkRect& rect, SkClipOp op) { clipRect(rect, op, false); } 62 void clipRect(const SkRect& rect, SkClipOp op) { clipRect(rect, op, false); }
65 void clipRect(const SkRect& rect, bool do_anti_alias) { 63 void clipRect(const SkRect& rect, bool do_anti_alias) {
66 clipRect(rect, SkClipOp::kIntersect, do_anti_alias); 64 clipRect(rect, SkClipOp::kIntersect, do_anti_alias);
67 } 65 }
68 void clipRect(const SkRect& rect) { 66 void clipRect(const SkRect& rect) {
69 clipRect(rect, SkClipOp::kIntersect, false); 67 clipRect(rect, SkClipOp::kIntersect, false);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 virtual void drawArc(const SkRect& oval, 117 virtual void drawArc(const SkRect& oval,
120 SkScalar start_angle, 118 SkScalar start_angle,
121 SkScalar sweep_angle, 119 SkScalar sweep_angle,
122 bool use_center, 120 bool use_center,
123 const PaintFlags& flags) = 0; 121 const PaintFlags& flags) = 0;
124 virtual void drawRoundRect(const SkRect& rect, 122 virtual void drawRoundRect(const SkRect& rect,
125 SkScalar rx, 123 SkScalar rx,
126 SkScalar ry, 124 SkScalar ry,
127 const PaintFlags& flags) = 0; 125 const PaintFlags& flags) = 0;
128 virtual void drawPath(const SkPath& path, const PaintFlags& flags) = 0; 126 virtual void drawPath(const SkPath& path, const PaintFlags& flags) = 0;
129 virtual void drawImage(const SkImage* image, 127 virtual void drawImage(sk_sp<const SkImage> image,
130 SkScalar left, 128 SkScalar left,
131 SkScalar top, 129 SkScalar top,
132 const PaintFlags* flags) = 0; 130 const PaintFlags* flags) = 0;
133 void drawImage(const SkImage* image, SkScalar left, SkScalar top) { 131 void drawImage(sk_sp<const SkImage> image, SkScalar left, SkScalar top) {
134 drawImage(image, left, top, nullptr);
135 }
136 virtual void drawImage(const sk_sp<SkImage>& image,
137 SkScalar left,
138 SkScalar top,
139 const PaintFlags* flags) = 0;
140 void drawImage(const sk_sp<SkImage>& image, SkScalar left, SkScalar top) {
141 drawImage(image, left, top, nullptr); 132 drawImage(image, left, top, nullptr);
142 } 133 }
143 134
144 enum SrcRectConstraint { 135 enum SrcRectConstraint {
145 kStrict_SrcRectConstraint = SkCanvas::kStrict_SrcRectConstraint, 136 kStrict_SrcRectConstraint = SkCanvas::kStrict_SrcRectConstraint,
146 kFast_SrcRectConstraint = SkCanvas::kFast_SrcRectConstraint, 137 kFast_SrcRectConstraint = SkCanvas::kFast_SrcRectConstraint,
147 }; 138 };
148 139
149 virtual void drawImageRect(const SkImage* image, 140 virtual void drawImageRect(sk_sp<const SkImage> image,
150 const SkRect& src, 141 const SkRect& src,
151 const SkRect& dst, 142 const SkRect& dst,
152 const PaintFlags* flags, 143 const PaintFlags* flags,
153 SrcRectConstraint constraint) = 0; 144 SrcRectConstraint constraint) = 0;
154 virtual void drawBitmap(const SkBitmap& bitmap, 145 virtual void drawBitmap(const SkBitmap& bitmap,
155 SkScalar left, 146 SkScalar left,
156 SkScalar top, 147 SkScalar top,
157 const PaintFlags* flags) = 0; 148 const PaintFlags* flags) = 0;
158 void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top) { 149 void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top) {
159 drawBitmap(bitmap, left, top, nullptr); 150 drawBitmap(bitmap, left, top, nullptr);
160 } 151 }
161 152
162 virtual void drawText(const void* text, 153 virtual void drawText(const void* text,
163 size_t byte_length, 154 size_t byte_length,
164 SkScalar x, 155 SkScalar x,
165 SkScalar y, 156 SkScalar y,
166 const PaintFlags& flags) = 0; 157 const PaintFlags& flags) = 0;
167 virtual void drawPosText(const void* text, 158 virtual void drawPosText(const void* text,
168 size_t byte_length, 159 size_t byte_length,
169 const SkPoint pos[], 160 const SkPoint pos[],
170 const PaintFlags& flags) = 0; 161 const PaintFlags& flags) = 0;
171 virtual void drawTextBlob(const SkTextBlob* blob, 162 virtual void drawTextBlob(sk_sp<SkTextBlob> blob,
172 SkScalar x,
173 SkScalar y,
174 const PaintFlags& flags) = 0;
175 virtual void drawTextBlob(const sk_sp<SkTextBlob>& blob,
176 SkScalar x, 163 SkScalar x,
177 SkScalar y, 164 SkScalar y,
178 const PaintFlags& flags) = 0; 165 const PaintFlags& flags) = 0;
179 166
180 virtual void drawPicture(const PaintRecord* record) = 0; 167 virtual void drawPicture(sk_sp<const PaintRecord> record,
181 virtual void drawPicture(const PaintRecord* record,
182 const SkMatrix* matrix, 168 const SkMatrix* matrix,
183 const PaintFlags* flags) = 0; 169 const PaintFlags* flags) = 0;
184 virtual void drawPicture(sk_sp<PaintRecord> record) = 0; 170 void drawPicture(sk_sp<const PaintRecord> record) {
171 drawPicture(record, nullptr, nullptr);
172 }
185 173
186 virtual bool isClipEmpty() const = 0; 174 virtual bool isClipEmpty() const = 0;
187 virtual bool isClipRect() const = 0; 175 virtual bool isClipRect() const = 0;
188 virtual const SkMatrix& getTotalMatrix() const = 0; 176 virtual const SkMatrix& getTotalMatrix() const = 0;
189 177
190 // For GraphicsContextCanvas only. Maybe this could be rewritten? 178 // For GraphicsContextCanvas only. Maybe this could be rewritten?
191 virtual void temporary_internal_describeTopLayer(SkMatrix* matrix, 179 virtual void temporary_internal_describeTopLayer(SkMatrix* matrix,
192 SkIRect* clip_bounds) = 0; 180 SkIRect* clip_bounds) = 0;
193 181
194 virtual bool ToPixmap(SkPixmap* output) = 0; 182 virtual bool ToPixmap(SkPixmap* output) = 0;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 const SkPoint& point, 254 const SkPoint& point,
267 SkData* data); 255 SkData* data);
268 256
269 CC_PAINT_EXPORT void PaintCanvasAnnotateLinkToDestination(PaintCanvas* canvas, 257 CC_PAINT_EXPORT void PaintCanvasAnnotateLinkToDestination(PaintCanvas* canvas,
270 const SkRect& rect, 258 const SkRect& rect,
271 SkData* data); 259 SkData* data);
272 260
273 } // namespace cc 261 } // namespace cc
274 262
275 #endif // CC_PAINT_PAINT_CANVAS_H_ 263 #endif // CC_PAINT_PAINT_CANVAS_H_
OLDNEW
« no previous file with comments | « cc/layers/picture_image_layer.cc ('k') | cc/paint/paint_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698