| OLD | NEW |
| (Empty) |
| 1 | |
| 2 /* | |
| 3 * Copyright 2011 Google Inc. | |
| 4 * | |
| 5 * Use of this source code is governed by a BSD-style license that can be | |
| 6 * found in the LICENSE file. | |
| 7 */ | |
| 8 #include "SkProxyCanvas.h" | |
| 9 | |
| 10 SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) { | |
| 11 SkSafeRef(fProxy); | |
| 12 } | |
| 13 | |
| 14 SkProxyCanvas::~SkProxyCanvas() { | |
| 15 SkSafeUnref(fProxy); | |
| 16 } | |
| 17 | |
| 18 void SkProxyCanvas::setProxy(SkCanvas* proxy) { | |
| 19 SkRefCnt_SafeAssign(fProxy, proxy); | |
| 20 } | |
| 21 | |
| 22 ///////////////////////////////// Overrides /////////// | |
| 23 | |
| 24 void SkProxyCanvas::willSave() { | |
| 25 fProxy->save(); | |
| 26 this->INHERITED::willSave(); | |
| 27 } | |
| 28 | |
| 29 SkCanvas::SaveLayerStrategy SkProxyCanvas::willSaveLayer(const SkRect* bounds, c
onst SkPaint* paint, | |
| 30 SaveFlags flags) { | |
| 31 fProxy->saveLayer(bounds, paint, flags); | |
| 32 this->INHERITED::willSaveLayer(bounds, paint, flags); | |
| 33 // No need for a layer. | |
| 34 return kNoLayer_SaveLayerStrategy; | |
| 35 } | |
| 36 | |
| 37 void SkProxyCanvas::willRestore() { | |
| 38 fProxy->restore(); | |
| 39 this->INHERITED::willRestore(); | |
| 40 } | |
| 41 | |
| 42 void SkProxyCanvas::didConcat(const SkMatrix& matrix) { | |
| 43 fProxy->concat(matrix); | |
| 44 this->INHERITED::didConcat(matrix); | |
| 45 } | |
| 46 | |
| 47 void SkProxyCanvas::didSetMatrix(const SkMatrix& matrix) { | |
| 48 fProxy->setMatrix(matrix); | |
| 49 this->INHERITED::didSetMatrix(matrix); | |
| 50 } | |
| 51 | |
| 52 void SkProxyCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { | |
| 53 fProxy->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle); | |
| 54 } | |
| 55 | |
| 56 void SkProxyCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeS
tyle edgeStyle) { | |
| 57 fProxy->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle); | |
| 58 } | |
| 59 | |
| 60 void SkProxyCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyl
e edgeStyle) { | |
| 61 fProxy->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle); | |
| 62 } | |
| 63 | |
| 64 void SkProxyCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { | |
| 65 fProxy->clipRegion(deviceRgn, op); | |
| 66 } | |
| 67 | |
| 68 void SkProxyCanvas::onDrawPaint(const SkPaint& paint) { | |
| 69 fProxy->drawPaint(paint); | |
| 70 } | |
| 71 | |
| 72 void SkProxyCanvas::onDrawPoints(PointMode mode, size_t count, | |
| 73 const SkPoint pts[], const SkPaint& paint) { | |
| 74 fProxy->drawPoints(mode, count, pts, paint); | |
| 75 } | |
| 76 | |
| 77 void SkProxyCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { | |
| 78 fProxy->drawOval(rect, paint); | |
| 79 } | |
| 80 | |
| 81 void SkProxyCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { | |
| 82 fProxy->drawRect(rect, paint); | |
| 83 } | |
| 84 | |
| 85 void SkProxyCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { | |
| 86 fProxy->drawRRect(rrect, paint); | |
| 87 } | |
| 88 | |
| 89 void SkProxyCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, | |
| 90 const SkPaint& paint) { | |
| 91 fProxy->drawDRRect(outer, inner, paint); | |
| 92 } | |
| 93 | |
| 94 void SkProxyCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { | |
| 95 fProxy->drawPath(path, paint); | |
| 96 } | |
| 97 | |
| 98 void SkProxyCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar to
p, | |
| 99 const SkPaint* paint) { | |
| 100 fProxy->drawImage(image, left, top, paint); | |
| 101 } | |
| 102 | |
| 103 void SkProxyCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, con
st SkRect& dst, | |
| 104 const SkPaint* paint) { | |
| 105 fProxy->drawImageRect(image, src, dst, paint); | |
| 106 } | |
| 107 | |
| 108 void SkProxyCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, | |
| 109 const SkPaint* paint) { | |
| 110 fProxy->drawBitmap(bitmap, x, y, paint); | |
| 111 } | |
| 112 | |
| 113 void SkProxyCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, | |
| 114 const SkPaint* paint, DrawBitmapRectFlags f
lags) { | |
| 115 fProxy->drawBitmapRectToRect(bitmap, src, dst, paint, flags); | |
| 116 } | |
| 117 | |
| 118 void SkProxyCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent
er, | |
| 119 const SkRect& dst, const SkPaint* paint) { | |
| 120 fProxy->drawBitmapNine(bitmap, center, dst, paint); | |
| 121 } | |
| 122 | |
| 123 void SkProxyCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkP
aint* paint) { | |
| 124 fProxy->drawSprite(bitmap, x, y, paint); | |
| 125 } | |
| 126 | |
| 127 void SkProxyCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, | |
| 128 const SkPaint& paint) { | |
| 129 fProxy->drawText(text, byteLength, x, y, paint); | |
| 130 } | |
| 131 | |
| 132 void SkProxyCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP
oint pos[], | |
| 133 const SkPaint& paint) { | |
| 134 fProxy->drawPosText(text, byteLength, pos, paint); | |
| 135 } | |
| 136 | |
| 137 void SkProxyCanvas::onDrawPosTextH(const void* text, size_t byteLength, const Sk
Scalar xpos[], | |
| 138 SkScalar constY, const SkPaint& paint) { | |
| 139 fProxy->drawPosTextH(text, byteLength, xpos, constY, paint); | |
| 140 } | |
| 141 | |
| 142 void SkProxyCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const
SkPath& path, | |
| 143 const SkMatrix* matrix, const SkPaint& pain
t) { | |
| 144 fProxy->drawTextOnPath(text, byteLength, path, matrix, paint); | |
| 145 } | |
| 146 | |
| 147 void SkProxyCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar
y, | |
| 148 const SkPaint& paint) { | |
| 149 fProxy->drawTextBlob(blob, x, y, paint); | |
| 150 } | |
| 151 | |
| 152 void SkProxyCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matr
ix, | |
| 153 const SkPaint* paint) { | |
| 154 fProxy->drawPicture(picture, matrix, paint); | |
| 155 } | |
| 156 | |
| 157 void SkProxyCanvas::onDrawVertices(VertexMode vmode, int vertexCount, | |
| 158 const SkPoint vertices[], const SkPoint texs[
], | |
| 159 const SkColor colors[], SkXfermode* xmode, | |
| 160 const uint16_t indices[], int indexCount, | |
| 161 const SkPaint& paint) { | |
| 162 fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors, | |
| 163 xmode, indices, indexCount, paint); | |
| 164 } | |
| 165 | |
| 166 void SkProxyCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4
], | |
| 167 const SkPoint texCoords[4], SkXfermode* xmode, | |
| 168 const SkPaint& paint) { | |
| 169 fProxy->drawPatch(cubics, colors, texCoords, xmode, paint); | |
| 170 } | |
| 171 | |
| 172 void SkProxyCanvas::beginCommentGroup(const char* description) { | |
| 173 fProxy->beginCommentGroup(description); | |
| 174 } | |
| 175 | |
| 176 void SkProxyCanvas::addComment(const char* kywd, const char* value) { | |
| 177 fProxy->addComment(kywd, value); | |
| 178 } | |
| 179 | |
| 180 void SkProxyCanvas::endCommentGroup() { | |
| 181 fProxy->endCommentGroup(); | |
| 182 } | |
| 183 | |
| 184 SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) { | |
| 185 return fProxy->setDrawFilter(filter); | |
| 186 } | |
| OLD | NEW |