blob: f67408698426314d04b9d1425919c02ff5420b83 [file] [log] [blame]
Derek Sollenberger1db141f2014-12-16 08:37:20 -05001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "SkiaCanvasProxy.h"
18
sergeyvaed7f582016-10-14 16:30:21 -070019#include "hwui/Bitmap.h"
20
Derek Sollenberger1db141f2014-12-16 08:37:20 -050021#include <cutils/log.h>
22#include <SkPatchUtils.h>
Ben Wagnera11ee3c2015-08-04 11:14:15 -040023#include <SkPaint.h>
24#include <SkPath.h>
Tom Hudson17c5adf2015-06-09 15:46:04 -040025#include <SkPixelRef.h>
Ben Wagnera11ee3c2015-08-04 11:14:15 -040026#include <SkRect.h>
27#include <SkRRect.h>
Yuqian Liafc221492016-07-18 13:07:42 -040028#include <SkRSXform.h>
Matt Sarett79fc3b12016-03-24 11:02:44 -040029#include <SkSurface.h>
Derek Sollenberger1db141f2014-12-16 08:37:20 -050030
Ben Wagner6bbf68d2015-08-19 11:26:06 -040031#include <memory>
32
Derek Sollenberger1db141f2014-12-16 08:37:20 -050033namespace android {
34namespace uirenderer {
35
Tom Hudsonb1476ae2015-03-05 10:30:18 -050036SkiaCanvasProxy::SkiaCanvasProxy(Canvas* canvas, bool filterHwuiCalls)
Derek Sollenberger1db141f2014-12-16 08:37:20 -050037 : INHERITED(canvas->width(), canvas->height())
Tom Hudsonb1476ae2015-03-05 10:30:18 -050038 , mCanvas(canvas)
39 , mFilterHwuiCalls(filterHwuiCalls) {}
Derek Sollenberger1db141f2014-12-16 08:37:20 -050040
41void SkiaCanvasProxy::onDrawPaint(const SkPaint& paint) {
42 mCanvas->drawPaint(paint);
43}
44
45void SkiaCanvasProxy::onDrawPoints(PointMode pointMode, size_t count, const SkPoint pts[],
46 const SkPaint& paint) {
Tom Hudsonb1476ae2015-03-05 10:30:18 -050047 if (!pts || count == 0) {
48 return;
49 }
50
Derek Sollenberger1db141f2014-12-16 08:37:20 -050051 // convert the SkPoints into floats
Ben Wagnere3a40ea2015-08-19 15:49:37 -040052 static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats");
Derek Sollenberger1db141f2014-12-16 08:37:20 -050053 const size_t floatCount = count << 1;
54 const float* floatArray = &pts[0].fX;
55
56 switch (pointMode) {
57 case kPoints_PointMode: {
58 mCanvas->drawPoints(floatArray, floatCount, paint);
59 break;
60 }
61 case kLines_PointMode: {
62 mCanvas->drawLines(floatArray, floatCount, paint);
63 break;
64 }
65 case kPolygon_PointMode: {
66 SkPaint strokedPaint(paint);
67 strokedPaint.setStyle(SkPaint::kStroke_Style);
68
69 SkPath path;
70 for (size_t i = 0; i < count - 1; i++) {
71 path.moveTo(pts[i]);
72 path.lineTo(pts[i+1]);
73 this->drawPath(path, strokedPaint);
74 path.rewind();
75 }
76 break;
77 }
78 default:
79 LOG_ALWAYS_FATAL("Unknown point type");
80 }
81}
82
83void SkiaCanvasProxy::onDrawOval(const SkRect& rect, const SkPaint& paint) {
84 mCanvas->drawOval(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, paint);
85}
86
87void SkiaCanvasProxy::onDrawRect(const SkRect& rect, const SkPaint& paint) {
88 mCanvas->drawRect(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, paint);
89}
90
91void SkiaCanvasProxy::onDrawRRect(const SkRRect& roundRect, const SkPaint& paint) {
92 if (!roundRect.isComplex()) {
93 const SkRect& rect = roundRect.rect();
94 SkVector radii = roundRect.getSimpleRadii();
95 mCanvas->drawRoundRect(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
96 radii.fX, radii.fY, paint);
97 } else {
98 SkPath path;
99 path.addRRect(roundRect);
100 mCanvas->drawPath(path, paint);
101 }
102}
103
104void SkiaCanvasProxy::onDrawPath(const SkPath& path, const SkPaint& paint) {
105 mCanvas->drawPath(path, paint);
106}
107
108void SkiaCanvasProxy::onDrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
109 const SkPaint* paint) {
sergeyvfc9999502016-10-17 13:07:38 -0700110 sk_sp<Bitmap> hwuiBitmap = Bitmap::createFrom(bitmap.info(), *bitmap.pixelRef());
Tom Hudson17c5adf2015-06-09 15:46:04 -0400111 // HWUI doesn't support extractSubset(), so convert any subsetted bitmap into
112 // a drawBitmapRect(); pass through an un-subsetted bitmap.
sergeyvfc9999502016-10-17 13:07:38 -0700113 if (hwuiBitmap && bitmap.dimensions() != hwuiBitmap->info().dimensions()) {
Tom Hudson17c5adf2015-06-09 15:46:04 -0400114 SkIPoint origin = bitmap.pixelRefOrigin();
sergeyvfc9999502016-10-17 13:07:38 -0700115 mCanvas->drawBitmap(*hwuiBitmap, origin.fX, origin.fY,
Tom Hudson17c5adf2015-06-09 15:46:04 -0400116 origin.fX + bitmap.dimensions().width(),
117 origin.fY + bitmap.dimensions().height(),
118 left, top,
119 left + bitmap.dimensions().width(),
120 top + bitmap.dimensions().height(),
121 paint);
122 } else {
sergeyvaed7f582016-10-14 16:30:21 -0700123 mCanvas->drawBitmap(*hwuiBitmap, left, top, paint);
Tom Hudson17c5adf2015-06-09 15:46:04 -0400124 }
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500125}
126
sergeyvfc9999502016-10-17 13:07:38 -0700127void SkiaCanvasProxy::onDrawBitmapRect(const SkBitmap& skBitmap, const SkRect* srcPtr,
Leon Scroggins IIIf35b9892015-07-31 10:38:40 -0400128 const SkRect& dst, const SkPaint* paint, SrcRectConstraint) {
sergeyvfc9999502016-10-17 13:07:38 -0700129 SkRect src = (srcPtr) ? *srcPtr : SkRect::MakeWH(skBitmap.width(), skBitmap.height());
Tom Hudson17c5adf2015-06-09 15:46:04 -0400130 // TODO: if bitmap is a subset, do we need to add pixelRefOrigin to src?
sergeyvfc9999502016-10-17 13:07:38 -0700131 Bitmap* bitmap = reinterpret_cast<Bitmap*>(skBitmap.pixelRef());
132 mCanvas->drawBitmap(*bitmap, src.fLeft, src.fTop, src.fRight, src.fBottom,
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500133 dst.fLeft, dst.fTop, dst.fRight, dst.fBottom, paint);
134}
135
136void SkiaCanvasProxy::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
137 const SkRect& dst, const SkPaint*) {
138 //TODO make nine-patch drawing a method on Canvas.h
139 SkDEBUGFAIL("SkiaCanvasProxy::onDrawBitmapNine is not yet supported");
140}
141
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500142void SkiaCanvasProxy::onDrawVertices(VertexMode mode, int vertexCount, const SkPoint vertices[],
Mike Reedc2f31df2016-10-28 17:21:45 -0400143 const SkPoint texs[], const SkColor colors[], SkBlendMode, const uint16_t indices[],
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500144 int indexCount, const SkPaint& paint) {
Mike Reedc2f31df2016-10-28 17:21:45 -0400145 // TODO: should we pass through blendmode
Tom Hudsonb1476ae2015-03-05 10:30:18 -0500146 if (mFilterHwuiCalls) {
147 return;
148 }
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500149 // convert the SkPoints into floats
Ben Wagnere3a40ea2015-08-19 15:49:37 -0400150 static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats");
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500151 const int floatCount = vertexCount << 1;
152 const float* vArray = &vertices[0].fX;
153 const float* tArray = (texs) ? &texs[0].fX : NULL;
154 const int* cArray = (colors) ? (int*)colors : NULL;
155 mCanvas->drawVertices(mode, floatCount, vArray, tArray, cArray, indices, indexCount, paint);
156}
157
Matt Sarett79fc3b12016-03-24 11:02:44 -0400158sk_sp<SkSurface> SkiaCanvasProxy::onNewSurface(const SkImageInfo&, const SkSurfaceProps&) {
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500159 SkDEBUGFAIL("SkiaCanvasProxy::onNewSurface is not supported");
160 return NULL;
161}
162
163void SkiaCanvasProxy::willSave() {
Florin Malitaeecff562015-12-21 10:43:01 -0500164 mCanvas->save(android::SaveFlags::MatrixClip);
165}
166
167static inline SaveFlags::Flags saveFlags(SkCanvas::SaveLayerFlags layerFlags) {
168 SaveFlags::Flags saveFlags = 0;
169
170 if (!(layerFlags & SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag)) {
171 saveFlags |= SaveFlags::ClipToLayer;
172 }
173
174 if (!(layerFlags & SkCanvas::kIsOpaque_SaveLayerFlag)) {
175 saveFlags |= SaveFlags::HasAlphaLayer;
176 }
177
178 return saveFlags;
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500179}
180
Leon Scroggins III5518e7c2016-01-04 09:37:42 -0500181SkCanvas::SaveLayerStrategy SkiaCanvasProxy::getSaveLayerStrategy(const SaveLayerRec& saveLayerRec) {
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500182 SkRect rect;
Leon Scroggins III5518e7c2016-01-04 09:37:42 -0500183 if (saveLayerRec.fBounds) {
184 rect = *saveLayerRec.fBounds;
185 } else if (!mCanvas->getClipBounds(&rect)) {
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500186 rect = SkRect::MakeEmpty();
187 }
Leon Scroggins III5518e7c2016-01-04 09:37:42 -0500188 mCanvas->saveLayer(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, saveLayerRec.fPaint,
Florin Malitaeecff562015-12-21 10:43:01 -0500189 saveFlags(saveLayerRec.fSaveLayerFlags));
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500190 return SkCanvas::kNoLayer_SaveLayerStrategy;
191}
192
193void SkiaCanvasProxy::willRestore() {
194 mCanvas->restore();
195}
196
197void SkiaCanvasProxy::didConcat(const SkMatrix& matrix) {
198 mCanvas->concat(matrix);
199}
200
201void SkiaCanvasProxy::didSetMatrix(const SkMatrix& matrix) {
Chris Craik6daa13c2015-08-19 13:32:12 -0700202 mCanvas->setMatrix(matrix);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500203}
204
205void SkiaCanvasProxy::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
206 const SkPaint& paint) {
207 SkPath path;
208 path.addRRect(outer);
209 path.addRRect(inner);
210 path.setFillType(SkPath::kEvenOdd_FillType);
211 this->drawPath(path, paint);
212}
213
214/**
215 * Utility class that converts the incoming text & paint from the given encoding
216 * into glyphIDs.
217 */
218class GlyphIDConverter {
219public:
220 GlyphIDConverter(const void* text, size_t byteLength, const SkPaint& origPaint) {
221 paint = origPaint;
222 if (paint.getTextEncoding() == SkPaint::kGlyphID_TextEncoding) {
223 glyphIDs = (uint16_t*)text;
224 count = byteLength >> 1;
225 } else {
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400226 // ensure space for one glyph per ID given UTF8 encoding.
227 storage.reset(new uint16_t[byteLength]);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500228 glyphIDs = storage.get();
229 count = paint.textToGlyphs(text, byteLength, storage.get());
230 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
231 }
232 }
233
234 SkPaint paint;
235 uint16_t* glyphIDs;
236 int count;
237private:
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400238 std::unique_ptr<uint16_t[]> storage;
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500239};
240
241void SkiaCanvasProxy::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
242 const SkPaint& origPaint) {
243 // convert to glyphIDs if necessary
244 GlyphIDConverter glyphs(text, byteLength, origPaint);
245
246 // compute the glyph positions
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400247 std::unique_ptr<SkPoint[]> pointStorage(new SkPoint[glyphs.count]);
248 std::unique_ptr<SkScalar[]> glyphWidths(new SkScalar[glyphs.count]);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500249 glyphs.paint.getTextWidths(glyphs.glyphIDs, glyphs.count << 1, glyphWidths.get());
250
251 // compute conservative bounds
252 // NOTE: We could call the faster paint.getFontBounds for a less accurate,
253 // but even more conservative bounds if this is too slow.
254 SkRect bounds;
255 glyphs.paint.measureText(glyphs.glyphIDs, glyphs.count << 1, &bounds);
256
257 // adjust for non-left alignment
258 if (glyphs.paint.getTextAlign() != SkPaint::kLeft_Align) {
259 SkScalar stop = 0;
260 for (int i = 0; i < glyphs.count; i++) {
261 stop += glyphWidths[i];
262 }
263 if (glyphs.paint.getTextAlign() == SkPaint::kCenter_Align) {
264 stop = SkScalarHalf(stop);
265 }
266 if (glyphs.paint.isVerticalText()) {
267 y -= stop;
268 } else {
269 x -= stop;
270 }
271 }
272
273 // setup the first glyph position and adjust bounds if needed
Tom Hudson806a6f02015-02-19 17:11:32 -0500274 int xBaseline = 0;
275 int yBaseline = 0;
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500276 if (mCanvas->drawTextAbsolutePos()) {
277 bounds.offset(x,y);
Tom Hudson806a6f02015-02-19 17:11:32 -0500278 xBaseline = x;
279 yBaseline = y;
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500280 }
Tom Hudson806a6f02015-02-19 17:11:32 -0500281 pointStorage[0].set(xBaseline, yBaseline);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500282
283 // setup the remaining glyph positions
284 if (glyphs.paint.isVerticalText()) {
285 for (int i = 1; i < glyphs.count; i++) {
Tom Hudson806a6f02015-02-19 17:11:32 -0500286 pointStorage[i].set(xBaseline, glyphWidths[i-1] + pointStorage[i-1].fY);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500287 }
288 } else {
289 for (int i = 1; i < glyphs.count; i++) {
Tom Hudson806a6f02015-02-19 17:11:32 -0500290 pointStorage[i].set(glyphWidths[i-1] + pointStorage[i-1].fX, yBaseline);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500291 }
292 }
293
Ben Wagnere3a40ea2015-08-19 15:49:37 -0400294 static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats");
sergeyvdccca442016-03-21 15:38:21 -0700295 mCanvas->drawGlyphs(glyphs.glyphIDs, &pointStorage[0].fX, glyphs.count, glyphs.paint,
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500296 x, y, bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, 0);
297}
298
299void SkiaCanvasProxy::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
300 const SkPaint& origPaint) {
301 // convert to glyphIDs if necessary
302 GlyphIDConverter glyphs(text, byteLength, origPaint);
303
304 // convert to relative positions if necessary
305 int x, y;
306 const SkPoint* posArray;
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400307 std::unique_ptr<SkPoint[]> pointStorage;
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500308 if (mCanvas->drawTextAbsolutePos()) {
309 x = 0;
310 y = 0;
311 posArray = pos;
312 } else {
313 x = pos[0].fX;
314 y = pos[0].fY;
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400315 pointStorage.reset(new SkPoint[glyphs.count]);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500316 for (int i = 0; i < glyphs.count; i++) {
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400317 pointStorage[i].fX = pos[i].fX - x;
318 pointStorage[i].fY = pos[i].fY - y;
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500319 }
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400320 posArray = pointStorage.get();
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500321 }
322
Derek Sollenberger35934cc2016-03-23 14:59:10 -0400323 // Compute conservative bounds. If the content has already been processed
324 // by Minikin then it had already computed these bounds. Unfortunately,
325 // there is no way to capture those bounds as part of the Skia drawPosText
326 // API so we need to do that computation again here.
Stan Ilievd84d2ee2016-07-25 13:32:25 -0400327 SkRect bounds = SkRect::MakeEmpty();
Derek Sollenberger35934cc2016-03-23 14:59:10 -0400328 for (int i = 0; i < glyphs.count; i++) {
Stan Ilievd84d2ee2016-07-25 13:32:25 -0400329 SkRect glyphBounds = SkRect::MakeEmpty();
Derek Sollenberger35934cc2016-03-23 14:59:10 -0400330 glyphs.paint.measureText(&glyphs.glyphIDs[i], sizeof(uint16_t), &glyphBounds);
331 glyphBounds.offset(pos[i].fX, pos[i].fY);
332 bounds.join(glyphBounds);
333 }
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500334
Ben Wagnere3a40ea2015-08-19 15:49:37 -0400335 static_assert(sizeof(SkPoint) == sizeof(float)*2, "SkPoint is no longer two floats");
sergeyvdccca442016-03-21 15:38:21 -0700336 mCanvas->drawGlyphs(glyphs.glyphIDs, &posArray[0].fX, glyphs.count, glyphs.paint, x, y,
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500337 bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, 0);
338}
339
340void SkiaCanvasProxy::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
341 SkScalar constY, const SkPaint& paint) {
342 const size_t pointCount = byteLength >> 1;
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400343 std::unique_ptr<SkPoint[]> pts(new SkPoint[pointCount]);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500344 for (size_t i = 0; i < pointCount; i++) {
345 pts[i].set(xpos[i], constY);
346 }
Ben Wagner6bbf68d2015-08-19 11:26:06 -0400347 this->onDrawPosText(text, byteLength, pts.get(), paint);
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500348}
349
350void SkiaCanvasProxy::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
351 const SkMatrix* matrix, const SkPaint& origPaint) {
Yuqian Liafc221492016-07-18 13:07:42 -0400352 SkDEBUGFAIL("SkiaCanvasProxy::onDrawTextOnPath is not supported");
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500353}
354
Yuqian Liafc221492016-07-18 13:07:42 -0400355void SkiaCanvasProxy::onDrawTextRSXform(const void* text, size_t byteLength,
356 const SkRSXform xform[], const SkRect* cullRect, const SkPaint& paint) {
357 GlyphIDConverter glyphs(text, byteLength, paint); // Just get count
358 SkMatrix localM, currM, origM;
359 mCanvas->getMatrix(&currM);
360 origM = currM;
361 for (int i = 0; i < glyphs.count; i++) {
362 localM.setRSXform(*xform++);
363 currM.setConcat(origM, localM);
364 mCanvas->setMatrix(currM);
365 this->onDrawText((char*)text + (byteLength / glyphs.count * i),
366 byteLength / glyphs.count, 0, 0, paint);
367 }
368 mCanvas->setMatrix(origM);
369}
370
371
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500372void SkiaCanvasProxy::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
373 const SkPaint& paint) {
374 SkDEBUGFAIL("SkiaCanvasProxy::onDrawTextBlob is not supported");
375}
376
377void SkiaCanvasProxy::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
Mike Reedc2f31df2016-10-28 17:21:45 -0400378 const SkPoint texCoords[4], SkBlendMode bmode, const SkPaint& paint) {
Tom Hudsonb1476ae2015-03-05 10:30:18 -0500379 if (mFilterHwuiCalls) {
380 return;
381 }
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500382 SkPatchUtils::VertexData data;
383
384 SkMatrix matrix;
385 mCanvas->getMatrix(&matrix);
386 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, &matrix);
387
388 // It automatically adjusts lodX and lodY in case it exceeds the number of indices.
389 // If it fails to generate the vertices, then we do not draw.
390 if (SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), lod.height())) {
391 this->drawVertices(SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints,
Mike Reedc2f31df2016-10-28 17:21:45 -0400392 data.fTexCoords, data.fColors, bmode, data.fIndices, data.fIndexCount,
Derek Sollenberger1db141f2014-12-16 08:37:20 -0500393 paint);
394 }
395}
396
397void SkiaCanvasProxy::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) {
398 mCanvas->clipRect(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, op);
399}
400
401void SkiaCanvasProxy::onClipRRect(const SkRRect& roundRect, SkRegion::Op op, ClipEdgeStyle) {
402 SkPath path;
403 path.addRRect(roundRect);
404 mCanvas->clipPath(&path, op);
405}
406
407void SkiaCanvasProxy::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle) {
408 mCanvas->clipPath(&path, op);
409}
410
411void SkiaCanvasProxy::onClipRegion(const SkRegion& region, SkRegion::Op op) {
412 mCanvas->clipRegion(&region, op);
413}
414
415}; // namespace uirenderer
416}; // namespace android