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

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

Issue 1529803004: Revert of remove drawSprite from canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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/core/SkRecordDraw.cpp » ('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 "SkImage_Base.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst); 619 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
620 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size); 620 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
621 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_NINE, size) == fWriter.b ytesWritten()); 621 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_NINE, size) == fWriter.b ytesWritten());
622 this->addPaintPtr(paint); 622 this->addPaintPtr(paint);
623 this->addBitmap(bitmap); 623 this->addBitmap(bitmap);
624 this->addIRect(center); 624 this->addIRect(center);
625 this->addRect(dst); 625 this->addRect(dst);
626 this->validate(initialOffset, size); 626 this->validate(initialOffset, size);
627 } 627 }
628 628
629 void SkPictureRecord::onDrawSprite(const SkBitmap& bitmap, int left, int top,
630 const SkPaint* paint) {
631 // op + paint index + bitmap index + left + top
632 size_t size = 5 * kUInt32Size;
633 size_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
634 SkASSERT(initialOffset+get_paint_offset(DRAW_SPRITE, size) == fWriter.bytesW ritten());
635 this->addPaintPtr(paint);
636 this->addBitmap(bitmap);
637 this->addInt(left);
638 this->addInt(top);
639 this->validate(initialOffset, size);
640 }
641
629 void SkPictureRecord::onDrawText(const void* text, size_t byteLength, SkScalar x , SkScalar y, 642 void SkPictureRecord::onDrawText(const void* text, size_t byteLength, SkScalar x , SkScalar y,
630 const SkPaint& paint) { 643 const SkPaint& paint) {
631 // op + paint index + length + 'length' worth of chars + x + y 644 // op + paint index + length + 'length' worth of chars + x + y
632 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar); 645 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar);
633 646
634 DrawType op = DRAW_TEXT; 647 DrawType op = DRAW_TEXT;
635 size_t initialOffset = this->addDraw(op, &size); 648 size_t initialOffset = this->addDraw(op, &size);
636 SkASSERT(initialOffset+get_paint_offset(op, size) == fWriter.bytesWritten()) ; 649 SkASSERT(initialOffset+get_paint_offset(op, size) == fWriter.bytesWritten()) ;
637 this->addPaint(paint); 650 this->addPaint(paint);
638 this->addText(text, byteLength); 651 this->addText(text, byteLength);
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1064 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1052 int index = fTextBlobRefs.count(); 1065 int index = fTextBlobRefs.count();
1053 *fTextBlobRefs.append() = blob; 1066 *fTextBlobRefs.append() = blob;
1054 blob->ref(); 1067 blob->ref();
1055 // follow the convention of recording a 1-based index 1068 // follow the convention of recording a 1-based index
1056 this->addInt(index + 1); 1069 this->addInt(index + 1);
1057 } 1070 }
1058 1071
1059 /////////////////////////////////////////////////////////////////////////////// 1072 ///////////////////////////////////////////////////////////////////////////////
1060 1073
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698