epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #include "SkProxyCanvas.h" |
| 9 | |
| 10 | SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) { |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 11 | SkSafeRef(fProxy); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 12 | } |
| 13 | |
| 14 | SkProxyCanvas::~SkProxyCanvas() { |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 15 | SkSafeUnref(fProxy); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 16 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 17 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 18 | void SkProxyCanvas::setProxy(SkCanvas* proxy) { |
| 19 | SkRefCnt_SafeAssign(fProxy, proxy); |
| 20 | } |
| 21 | |
| 22 | ///////////////////////////////// Overrides /////////// |
| 23 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 24 | int SkProxyCanvas::save(SaveFlags flags) { |
| 25 | return fProxy->save(flags); |
| 26 | } |
| 27 | |
| 28 | int SkProxyCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, |
| 29 | SaveFlags flags) { |
| 30 | return fProxy->saveLayer(bounds, paint, flags); |
| 31 | } |
| 32 | |
| 33 | void SkProxyCanvas::restore() { |
| 34 | fProxy->restore(); |
| 35 | } |
| 36 | |
| 37 | bool SkProxyCanvas::translate(SkScalar dx, SkScalar dy) { |
| 38 | return fProxy->translate(dx, dy); |
| 39 | } |
| 40 | |
| 41 | bool SkProxyCanvas::scale(SkScalar sx, SkScalar sy) { |
| 42 | return fProxy->scale(sx, sy); |
| 43 | } |
| 44 | |
| 45 | bool SkProxyCanvas::rotate(SkScalar degrees) { |
| 46 | return fProxy->rotate(degrees); |
| 47 | } |
| 48 | |
| 49 | bool SkProxyCanvas::skew(SkScalar sx, SkScalar sy) { |
| 50 | return fProxy->skew(sx, sy); |
| 51 | } |
| 52 | |
| 53 | bool SkProxyCanvas::concat(const SkMatrix& matrix) { |
| 54 | return fProxy->concat(matrix); |
| 55 | } |
| 56 | |
| 57 | void SkProxyCanvas::setMatrix(const SkMatrix& matrix) { |
| 58 | fProxy->setMatrix(matrix); |
| 59 | } |
| 60 | |
reed@google.com | 071eef9 | 2011-10-12 11:52:53 +0000 | [diff] [blame] | 61 | bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { |
| 62 | return fProxy->clipRect(rect, op, doAA); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 63 | } |
| 64 | |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 65 | bool SkProxyCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { |
| 66 | return fProxy->clipRRect(rrect, op, doAA); |
| 67 | } |
| 68 | |
reed@google.com | 071eef9 | 2011-10-12 11:52:53 +0000 | [diff] [blame] | 69 | bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |
| 70 | return fProxy->clipPath(path, op, doAA); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | bool SkProxyCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { |
| 74 | return fProxy->clipRegion(deviceRgn, op); |
| 75 | } |
| 76 | |
| 77 | void SkProxyCanvas::drawPaint(const SkPaint& paint) { |
| 78 | fProxy->drawPaint(paint); |
| 79 | } |
| 80 | |
| 81 | void SkProxyCanvas::drawPoints(PointMode mode, size_t count, |
| 82 | const SkPoint pts[], const SkPaint& paint) { |
| 83 | fProxy->drawPoints(mode, count, pts, paint); |
| 84 | } |
| 85 | |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 86 | void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { |
| 87 | fProxy->drawOval(rect, paint); |
| 88 | } |
| 89 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 90 | void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { |
| 91 | fProxy->drawRect(rect, paint); |
| 92 | } |
| 93 | |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 94 | void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { |
| 95 | fProxy->drawRRect(rrect, paint); |
| 96 | } |
| 97 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 98 | void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
| 99 | fProxy->drawPath(path, paint); |
| 100 | } |
| 101 | |
| 102 | void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, |
| 103 | const SkPaint* paint) { |
| 104 | fProxy->drawBitmap(bitmap, x, y, paint); |
| 105 | } |
| 106 | |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 107 | void SkProxyCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 108 | const SkRect& dst, const SkPaint* paint) { |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 109 | fProxy->drawBitmapRectToRect(bitmap, src, dst, paint); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | void SkProxyCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, |
| 113 | const SkPaint* paint) { |
| 114 | fProxy->drawBitmapMatrix(bitmap, m, paint); |
| 115 | } |
| 116 | |
| 117 | void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, |
| 118 | const SkPaint* paint) { |
| 119 | fProxy->drawSprite(bitmap, x, y, paint); |
| 120 | } |
| 121 | |
| 122 | void SkProxyCanvas::drawText(const void* text, size_t byteLength, SkScalar x, |
| 123 | SkScalar y, const SkPaint& paint) { |
| 124 | fProxy->drawText(text, byteLength, x, y, paint); |
| 125 | } |
| 126 | |
| 127 | void SkProxyCanvas::drawPosText(const void* text, size_t byteLength, |
| 128 | const SkPoint pos[], const SkPaint& paint) { |
| 129 | fProxy->drawPosText(text, byteLength, pos, paint); |
| 130 | } |
| 131 | |
| 132 | void SkProxyCanvas::drawPosTextH(const void* text, size_t byteLength, |
| 133 | const SkScalar xpos[], SkScalar constY, |
| 134 | const SkPaint& paint) { |
| 135 | fProxy->drawPosTextH(text, byteLength, xpos, constY, paint); |
| 136 | } |
| 137 | |
| 138 | void SkProxyCanvas::drawTextOnPath(const void* text, size_t byteLength, |
| 139 | const SkPath& path, const SkMatrix* matrix, |
| 140 | const SkPaint& paint) { |
| 141 | fProxy->drawTextOnPath(text, byteLength, path, matrix, paint); |
| 142 | } |
| 143 | |
reed@android.com | ed0bfb0 | 2009-05-13 21:01:21 +0000 | [diff] [blame] | 144 | void SkProxyCanvas::drawPicture(SkPicture& picture) { |
| 145 | fProxy->drawPicture(picture); |
| 146 | } |
| 147 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 148 | void SkProxyCanvas::drawVertices(VertexMode vmode, int vertexCount, |
| 149 | const SkPoint vertices[], const SkPoint texs[], |
| 150 | const SkColor colors[], SkXfermode* xmode, |
| 151 | const uint16_t indices[], int indexCount, |
| 152 | const SkPaint& paint) { |
| 153 | fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors, |
| 154 | xmode, indices, indexCount, paint); |
| 155 | } |
| 156 | |
reed@android.com | cb60844 | 2009-12-04 21:32:27 +0000 | [diff] [blame] | 157 | void SkProxyCanvas::drawData(const void* data, size_t length) { |
| 158 | fProxy->drawData(data, length); |
| 159 | } |
| 160 | |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame^] | 161 | void SkProxyCanvas::beginCommentGroup(const char* description) { |
| 162 | fProxy->beginCommentGroup(description); |
| 163 | } |
| 164 | |
| 165 | void SkProxyCanvas::addComment(const char* kywd, const char* value) { |
| 166 | fProxy->addComment(kywd, value); |
| 167 | } |
| 168 | |
| 169 | void SkProxyCanvas::endCommentGroup() { |
| 170 | fProxy->endCommentGroup(); |
| 171 | } |
| 172 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 173 | SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) { |
| 174 | return fProxy->setBounder(bounder); |
| 175 | } |
| 176 | |
| 177 | SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) { |
| 178 | return fProxy->setDrawFilter(filter); |
| 179 | } |