OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "skia/ext/benchmarking_canvas.h" | 8 #include "skia/ext/benchmarking_canvas.h" |
9 #include "third_party/skia/include/utils/SkProxyCanvas.h" | 9 #include "third_party/skia/include/utils/SkProxyCanvas.h" |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 AutoStamper stamper(this); | 107 AutoStamper stamper(this); |
108 SkProxyCanvas::drawBitmapMatrix(bitmap, m, paint); | 108 SkProxyCanvas::drawBitmapMatrix(bitmap, m, paint); |
109 } | 109 } |
110 | 110 |
111 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, | 111 virtual void drawSprite(const SkBitmap& bitmap, int left, int top, |
112 const SkPaint* paint = NULL) OVERRIDE { | 112 const SkPaint* paint = NULL) OVERRIDE { |
113 AutoStamper stamper(this); | 113 AutoStamper stamper(this); |
114 SkProxyCanvas::drawSprite(bitmap, left, top, paint); | 114 SkProxyCanvas::drawSprite(bitmap, left, top, paint); |
115 } | 115 } |
116 | 116 |
117 virtual void drawText(const void* text, size_t byteLength, SkScalar x, | |
118 SkScalar y, const SkPaint& paint) OVERRIDE { | |
119 AutoStamper stamper(this); | |
120 SkProxyCanvas::drawText(text, byteLength, x, y, paint); | |
121 } | |
122 | |
123 virtual void drawPosText(const void* text, size_t byteLength, | |
124 const SkPoint pos[], | |
125 const SkPaint& paint) OVERRIDE { | |
126 AutoStamper stamper(this); | |
127 SkProxyCanvas::drawPosText(text, byteLength, pos, paint); | |
128 } | |
129 | |
130 virtual void drawPosTextH(const void* text, size_t byteLength, | |
131 const SkScalar xpos[], SkScalar constY, | |
132 const SkPaint& paint) OVERRIDE { | |
133 AutoStamper stamper(this); | |
134 SkProxyCanvas::drawPosTextH(text, byteLength, xpos, constY, paint); | |
135 } | |
136 | |
137 virtual void drawTextOnPath(const void* text, size_t byteLength, | |
138 const SkPath& path, const SkMatrix* matrix, | |
139 const SkPaint& paint) OVERRIDE { | |
140 AutoStamper stamper(this); | |
141 SkProxyCanvas::drawTextOnPath(text, byteLength, path, matrix, paint); | |
142 } | |
143 | |
144 virtual void drawPicture(SkPicture& picture) OVERRIDE { | 117 virtual void drawPicture(SkPicture& picture) OVERRIDE { |
145 AutoStamper stamper(this); | 118 AutoStamper stamper(this); |
146 SkProxyCanvas::drawPicture(picture); | 119 SkProxyCanvas::drawPicture(picture); |
147 } | 120 } |
148 | 121 |
149 virtual void drawVertices(VertexMode vmode, int vertexCount, | 122 virtual void drawVertices(VertexMode vmode, int vertexCount, |
150 const SkPoint vertices[], const SkPoint texs[], | 123 const SkPoint vertices[], const SkPoint texs[], |
151 const SkColor colors[], SkXfermode* xmode, | 124 const SkColor colors[], SkXfermode* xmode, |
152 const uint16_t indices[], int indexCount, | 125 const uint16_t indices[], int indexCount, |
153 const SkPaint& paint) OVERRIDE { | 126 const SkPaint& paint) OVERRIDE { |
154 AutoStamper stamper(this); | 127 AutoStamper stamper(this); |
155 SkProxyCanvas::drawVertices(vmode, vertexCount, vertices, texs, colors, | 128 SkProxyCanvas::drawVertices(vmode, vertexCount, vertices, texs, colors, |
156 xmode, indices, indexCount, paint); | 129 xmode, indices, indexCount, paint); |
157 } | 130 } |
158 | 131 |
159 virtual void drawData(const void* data, size_t length) OVERRIDE { | 132 virtual void drawData(const void* data, size_t length) OVERRIDE { |
160 AutoStamper stamper(this); | 133 AutoStamper stamper(this); |
161 SkProxyCanvas::drawData(data, length); | 134 SkProxyCanvas::drawData(data, length); |
162 } | 135 } |
163 | 136 |
164 protected: | 137 protected: |
| 138 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
| 139 SkScalar y, const SkPaint& paint) OVERRIDE { |
| 140 AutoStamper stamper(this); |
| 141 SkProxyCanvas::onDrawText(text, byteLength, x, y, paint); |
| 142 } |
| 143 |
| 144 virtual void onDrawPosText(const void* text, size_t byteLength, |
| 145 const SkPoint pos[], |
| 146 const SkPaint& paint) OVERRIDE { |
| 147 AutoStamper stamper(this); |
| 148 SkProxyCanvas::onDrawPosText(text, byteLength, pos, paint); |
| 149 } |
| 150 |
| 151 virtual void onDrawPosTextH(const void* text, size_t byteLength, |
| 152 const SkScalar xpos[], SkScalar constY, |
| 153 const SkPaint& paint) OVERRIDE { |
| 154 AutoStamper stamper(this); |
| 155 SkProxyCanvas::onDrawPosTextH(text, byteLength, xpos, constY, paint); |
| 156 } |
| 157 |
| 158 virtual void onDrawTextOnPath(const void* text, size_t byteLength, |
| 159 const SkPath& path, const SkMatrix* matrix, |
| 160 const SkPaint& paint) OVERRIDE { |
| 161 AutoStamper stamper(this); |
| 162 SkProxyCanvas::onDrawTextOnPath(text, byteLength, path, matrix, paint); |
| 163 } |
| 164 |
165 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, | 165 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, |
166 ClipEdgeStyle edge_style) OVERRIDE { | 166 ClipEdgeStyle edge_style) OVERRIDE { |
167 AutoStamper stamper(this); | 167 AutoStamper stamper(this); |
168 SkProxyCanvas::onClipRect(rect, op, edge_style); | 168 SkProxyCanvas::onClipRect(rect, op, edge_style); |
169 } | 169 } |
170 | 170 |
171 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, | 171 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, |
172 ClipEdgeStyle edge_style) OVERRIDE { | 172 ClipEdgeStyle edge_style) OVERRIDE { |
173 AutoStamper stamper(this); | 173 AutoStamper stamper(this); |
174 SkProxyCanvas::onClipRRect(rrect, op, edge_style); | 174 SkProxyCanvas::onClipRRect(rrect, op, edge_style); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); | 229 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); |
230 return debug_canvas_->getDrawCommandAt(index); | 230 return debug_canvas_->getDrawCommandAt(index); |
231 } | 231 } |
232 | 232 |
233 double BenchmarkingCanvas::GetTime(size_t index) { | 233 double BenchmarkingCanvas::GetTime(size_t index) { |
234 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); | 234 DCHECK_LT(index, static_cast<size_t>(debug_canvas_->getSize())); |
235 return timing_canvas_->GetTime(index); | 235 return timing_canvas_->GetTime(index); |
236 } | 236 } |
237 | 237 |
238 } // namespace skia | 238 } // namespace skia |
OLD | NEW |