OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); | 181 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); |
182 const SkPoint& loc = reader->skipT<SkPoint>(); | 182 const SkPoint& loc = reader->skipT<SkPoint>(); |
183 canvas->drawBitmap(bitmap, loc.fX, loc.fY, paint); | 183 canvas->drawBitmap(bitmap, loc.fX, loc.fY, paint); |
184 } break; | 184 } break; |
185 case DRAW_BITMAP_RECT: { | 185 case DRAW_BITMAP_RECT: { |
186 const SkPaint* paint = fPictureData->getPaint(reader); | 186 const SkPaint* paint = fPictureData->getPaint(reader); |
187 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); | 187 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); |
188 const SkRect* src = get_rect_ptr(reader); // may be null | 188 const SkRect* src = get_rect_ptr(reader); // may be null |
189 const SkRect& dst = reader->skipT<SkRect>(); // required | 189 const SkRect& dst = reader->skipT<SkRect>(); // required |
190 SkCanvas::SrcRectConstraint constraint = (SkCanvas::SrcRectConstrain
t)reader->readInt(); | 190 SkCanvas::SrcRectConstraint constraint = (SkCanvas::SrcRectConstrain
t)reader->readInt(); |
191 canvas->drawBitmapRect(bitmap, src, dst, paint, constraint); | 191 canvas->legacy_drawBitmapRect(bitmap, src, dst, paint, constraint); |
192 } break; | 192 } break; |
193 case DRAW_BITMAP_MATRIX: { | 193 case DRAW_BITMAP_MATRIX: { |
194 const SkPaint* paint = fPictureData->getPaint(reader); | 194 const SkPaint* paint = fPictureData->getPaint(reader); |
195 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); | 195 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); |
196 SkMatrix matrix; | 196 SkMatrix matrix; |
197 reader->readMatrix(&matrix); | 197 reader->readMatrix(&matrix); |
198 | 198 |
199 SkAutoCanvasRestore acr(canvas, true); | 199 SkAutoCanvasRestore acr(canvas, true); |
200 canvas->concat(matrix); | 200 canvas->concat(matrix); |
201 canvas->drawBitmap(bitmap, 0, 0, paint); | 201 canvas->drawBitmap(bitmap, 0, 0, paint); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 const SkPaint* paint = fPictureData->getPaint(reader); | 253 const SkPaint* paint = fPictureData->getPaint(reader); |
254 const SkImage* image = fPictureData->getImage(reader); | 254 const SkImage* image = fPictureData->getImage(reader); |
255 const SkRect* src = get_rect_ptr(reader); // may be null | 255 const SkRect* src = get_rect_ptr(reader); // may be null |
256 const SkRect& dst = reader->skipT<SkRect>(); // required | 256 const SkRect& dst = reader->skipT<SkRect>(); // required |
257 // DRAW_IMAGE_RECT_STRICT assumes this constraint, and doesn't store
it | 257 // DRAW_IMAGE_RECT_STRICT assumes this constraint, and doesn't store
it |
258 SkCanvas::SrcRectConstraint constraint = SkCanvas::kStrict_SrcRectCo
nstraint; | 258 SkCanvas::SrcRectConstraint constraint = SkCanvas::kStrict_SrcRectCo
nstraint; |
259 if (DRAW_IMAGE_RECT == op) { | 259 if (DRAW_IMAGE_RECT == op) { |
260 // newer op-code stores the constraint explicitly | 260 // newer op-code stores the constraint explicitly |
261 constraint = (SkCanvas::SrcRectConstraint)reader->readInt(); | 261 constraint = (SkCanvas::SrcRectConstraint)reader->readInt(); |
262 } | 262 } |
263 canvas->drawImageRect(image, src, dst, paint, constraint); | 263 canvas->legacy_drawImageRect(image, src, dst, paint, constraint); |
264 } break; | 264 } break; |
265 case DRAW_OVAL: { | 265 case DRAW_OVAL: { |
266 const SkPaint& paint = *fPictureData->getPaint(reader); | 266 const SkPaint& paint = *fPictureData->getPaint(reader); |
267 canvas->drawOval(reader->skipT<SkRect>(), paint); | 267 canvas->drawOval(reader->skipT<SkRect>(), paint); |
268 } break; | 268 } break; |
269 case DRAW_PAINT: | 269 case DRAW_PAINT: |
270 canvas->drawPaint(*fPictureData->getPaint(reader)); | 270 canvas->drawPaint(*fPictureData->getPaint(reader)); |
271 break; | 271 break; |
272 case DRAW_PATCH: { | 272 case DRAW_PATCH: { |
273 const SkPaint& paint = *fPictureData->getPaint(reader); | 273 const SkPaint& paint = *fPictureData->getPaint(reader); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 case TRANSLATE: { | 479 case TRANSLATE: { |
480 SkScalar dx = reader->readScalar(); | 480 SkScalar dx = reader->readScalar(); |
481 SkScalar dy = reader->readScalar(); | 481 SkScalar dy = reader->readScalar(); |
482 canvas->translate(dx, dy); | 482 canvas->translate(dx, dy); |
483 } break; | 483 } break; |
484 default: | 484 default: |
485 SkASSERTF(false, "Unknown draw type: %d", op); | 485 SkASSERTF(false, "Unknown draw type: %d", op); |
486 } | 486 } |
487 } | 487 } |
488 | 488 |
OLD | NEW |