Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: src/core/SkPictureRecord.cpp

Issue 1126273002: Revert of Revert of Make drawImage a virtual on SkDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkImage_Base.h"
10 #include "SkPatchUtils.h" 11 #include "SkPatchUtils.h"
11 #include "SkPixelRef.h" 12 #include "SkPixelRef.h"
12 #include "SkRRect.h" 13 #include "SkRRect.h"
13 #include "SkTextBlob.h" 14 #include "SkTextBlob.h"
14 #include "SkTSearch.h" 15 #include "SkTSearch.h"
15 16
16 #define HEAP_BLOCK_SIZE 4096 17 #define HEAP_BLOCK_SIZE 4096
17 18
18 enum { 19 enum {
19 // just need a value that save or getSaveCount would never return 20 // just need a value that save or getSaveCount would never return
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_RECT_TO_RECT, size) 557 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_RECT_TO_RECT, size)
557 == fWriter.bytesWritten()); 558 == fWriter.bytesWritten());
558 this->addPaintPtr(paint); 559 this->addPaintPtr(paint);
559 this->addBitmap(bitmap); 560 this->addBitmap(bitmap);
560 this->addRectPtr(src); // may be null 561 this->addRectPtr(src); // may be null
561 this->addRect(dst); 562 this->addRect(dst);
562 this->addInt(flags); 563 this->addInt(flags);
563 this->validate(initialOffset, size); 564 this->validate(initialOffset, size);
564 } 565 }
565 566
567 void SkPictureRecord::onDrawImage(const SkImage* image, SkScalar x, SkScalar y,
568 const SkPaint* paint) {
569 SkBitmap bm;
570 if (as_IB(image)->getROPixels(&bm)) {
571 this->SkPictureRecord::onDrawBitmap(bm, x, y, paint);
572 }
573 }
574
575 void SkPictureRecord::onDrawImageRect(const SkImage* image, const SkRect* src, c onst SkRect& dst,
576 const SkPaint* paint) {
577 SkBitmap bm;
578 if (as_IB(image)->getROPixels(&bm)) {
579 this->SkPictureRecord::onDrawBitmapRect(bm, src, dst, paint, kNone_DrawB itmapRectFlag);
580 }
581 }
582
566 void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& ce nter, 583 void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& ce nter,
567 const SkRect& dst, const SkPaint* paint) { 584 const SkRect& dst, const SkPaint* paint) {
568 // op + paint index + bitmap id + center + dst rect 585 // op + paint index + bitmap id + center + dst rect
569 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst); 586 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
570 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size); 587 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
571 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_NINE, size) == fWriter.b ytesWritten()); 588 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_NINE, size) == fWriter.b ytesWritten());
572 this->addPaintPtr(paint); 589 this->addPaintPtr(paint);
573 this->addBitmap(bitmap); 590 this->addBitmap(bitmap);
574 this->addIRect(center); 591 this->addIRect(center);
575 this->addRect(dst); 592 this->addRect(dst);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1008 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
992 int index = fTextBlobRefs.count(); 1009 int index = fTextBlobRefs.count();
993 *fTextBlobRefs.append() = blob; 1010 *fTextBlobRefs.append() = blob;
994 blob->ref(); 1011 blob->ref();
995 // follow the convention of recording a 1-based index 1012 // follow the convention of recording a 1-based index
996 this->addInt(index + 1); 1013 this->addInt(index + 1);
997 } 1014 }
998 1015
999 /////////////////////////////////////////////////////////////////////////////// 1016 ///////////////////////////////////////////////////////////////////////////////
1000 1017
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698