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

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

Issue 1530203002: Reland of move 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
642 void SkPictureRecord::onDrawText(const void* text, size_t byteLength, SkScalar x , SkScalar y, 629 void SkPictureRecord::onDrawText(const void* text, size_t byteLength, SkScalar x , SkScalar y,
643 const SkPaint& paint) { 630 const SkPaint& paint) {
644 // op + paint index + length + 'length' worth of chars + x + y 631 // op + paint index + length + 'length' worth of chars + x + y
645 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar); 632 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar);
646 633
647 DrawType op = DRAW_TEXT; 634 DrawType op = DRAW_TEXT;
648 size_t initialOffset = this->addDraw(op, &size); 635 size_t initialOffset = this->addDraw(op, &size);
649 SkASSERT(initialOffset+get_paint_offset(op, size) == fWriter.bytesWritten()) ; 636 SkASSERT(initialOffset+get_paint_offset(op, size) == fWriter.bytesWritten()) ;
650 this->addPaint(paint); 637 this->addPaint(paint);
651 this->addText(text, byteLength); 638 this->addText(text, byteLength);
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1051 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1065 int index = fTextBlobRefs.count(); 1052 int index = fTextBlobRefs.count();
1066 *fTextBlobRefs.append() = blob; 1053 *fTextBlobRefs.append() = blob;
1067 blob->ref(); 1054 blob->ref();
1068 // follow the convention of recording a 1-based index 1055 // follow the convention of recording a 1-based index
1069 this->addInt(index + 1); 1056 this->addInt(index + 1);
1070 } 1057 }
1071 1058
1072 /////////////////////////////////////////////////////////////////////////////// 1059 ///////////////////////////////////////////////////////////////////////////////
1073 1060
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