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

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

Issue 1124003002: 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"
11 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
12 #include "SkPixelRef.h" 11 #include "SkPixelRef.h"
13 #include "SkRRect.h" 12 #include "SkRRect.h"
14 #include "SkTextBlob.h" 13 #include "SkTextBlob.h"
15 #include "SkTSearch.h" 14 #include "SkTSearch.h"
16 15
17 #define HEAP_BLOCK_SIZE 4096 16 #define HEAP_BLOCK_SIZE 4096
18 17
19 enum { 18 enum {
20 // just need a value that save or getSaveCount would never return 19 // just need a value that save or getSaveCount would never return
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_RECT_TO_RECT, size) 556 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_RECT_TO_RECT, size)
558 == fWriter.bytesWritten()); 557 == fWriter.bytesWritten());
559 this->addPaintPtr(paint); 558 this->addPaintPtr(paint);
560 this->addBitmap(bitmap); 559 this->addBitmap(bitmap);
561 this->addRectPtr(src); // may be null 560 this->addRectPtr(src); // may be null
562 this->addRect(dst); 561 this->addRect(dst);
563 this->addInt(flags); 562 this->addInt(flags);
564 this->validate(initialOffset, size); 563 this->validate(initialOffset, size);
565 } 564 }
566 565
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
583 void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& ce nter, 566 void SkPictureRecord::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& ce nter,
584 const SkRect& dst, const SkPaint* paint) { 567 const SkRect& dst, const SkPaint* paint) {
585 // op + paint index + bitmap id + center + dst rect 568 // op + paint index + bitmap id + center + dst rect
586 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst); 569 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
587 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size); 570 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
588 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_NINE, size) == fWriter.b ytesWritten()); 571 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_NINE, size) == fWriter.b ytesWritten());
589 this->addPaintPtr(paint); 572 this->addPaintPtr(paint);
590 this->addBitmap(bitmap); 573 this->addBitmap(bitmap);
591 this->addIRect(center); 574 this->addIRect(center);
592 this->addRect(dst); 575 this->addRect(dst);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 991 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1009 int index = fTextBlobRefs.count(); 992 int index = fTextBlobRefs.count();
1010 *fTextBlobRefs.append() = blob; 993 *fTextBlobRefs.append() = blob;
1011 blob->ref(); 994 blob->ref();
1012 // follow the convention of recording a 1-based index 995 // follow the convention of recording a 1-based index
1013 this->addInt(index + 1); 996 this->addInt(index + 1);
1014 } 997 }
1015 998
1016 /////////////////////////////////////////////////////////////////////////////// 999 ///////////////////////////////////////////////////////////////////////////////
1017 1000
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