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

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

Issue 1228083004: add src-rect-constraint to drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: propogate Constraint into SkDevice Created 5 years, 5 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
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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 size_t initialOffset = this->addDraw(DRAW_IMAGE, &size); 577 size_t initialOffset = this->addDraw(DRAW_IMAGE, &size);
578 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE, size) == fWriter.bytesWr itten()); 578 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE, size) == fWriter.bytesWr itten());
579 this->addPaintPtr(paint); 579 this->addPaintPtr(paint);
580 this->addImage(image); 580 this->addImage(image);
581 this->addScalar(x); 581 this->addScalar(x);
582 this->addScalar(y); 582 this->addScalar(y);
583 this->validate(initialOffset, size); 583 this->validate(initialOffset, size);
584 } 584 }
585 585
586 void SkPictureRecord::onDrawImageRect(const SkImage* image, const SkRect* src, c onst SkRect& dst, 586 void SkPictureRecord::onDrawImageRect(const SkImage* image, const SkRect* src, c onst SkRect& dst,
587 const SkPaint* paint) { 587 const SkPaint* paint SRC_RECT_CONSTRAINT_P ARAM(constraint)) {
588 // id + paint_index + image_index + bool_for_src 588 SRC_RECT_CONSTRAINT_LOCAL_DEFAULT(constraint)
589 size_t size = 4 * kUInt32Size; 589 // id + paint_index + image_index + bool_for_src + constraint
590 size_t size = 5 * kUInt32Size;
590 if (src) { 591 if (src) {
591 size += sizeof(*src); // + rect 592 size += sizeof(*src); // + rect
592 } 593 }
593 size += sizeof(dst); // + rect 594 size += sizeof(dst); // + rect
594 595
595 size_t initialOffset = this->addDraw(DRAW_IMAGE_RECT, &size); 596 size_t initialOffset = this->addDraw(DRAW_IMAGE_RECT, &size);
596 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE_RECT, size) 597 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE_RECT, size)
597 == fWriter.bytesWritten()); 598 == fWriter.bytesWritten());
598 this->addPaintPtr(paint); 599 this->addPaintPtr(paint);
599 this->addImage(image); 600 this->addImage(image);
600 this->addRectPtr(src); // may be null 601 this->addRectPtr(src); // may be null
601 this->addRect(dst); 602 this->addRect(dst);
603 this->addInt(constraint);
602 this->validate(initialOffset, size); 604 this->validate(initialOffset, size);
603 } 605 }
604 606
605 void SkPictureRecord::onDrawImageNine(const SkImage* img, const SkIRect& center, const SkRect& dst, 607 void SkPictureRecord::onDrawImageNine(const SkImage* img, const SkIRect& center, const SkRect& dst,
606 const SkPaint* paint) { 608 const SkPaint* paint) {
607 // id + paint_index + image_index + center + dst 609 // id + paint_index + image_index + center + dst
608 size_t size = 3 * kUInt32Size + sizeof(SkIRect) + sizeof(SkRect); 610 size_t size = 3 * kUInt32Size + sizeof(SkIRect) + sizeof(SkRect);
609 611
610 size_t initialOffset = this->addDraw(DRAW_IMAGE_NINE, &size); 612 size_t initialOffset = this->addDraw(DRAW_IMAGE_NINE, &size);
611 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE_NINE, size) == fWriter.by tesWritten()); 613 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE_NINE, size) == fWriter.by tesWritten());
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1065 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1064 int index = fTextBlobRefs.count(); 1066 int index = fTextBlobRefs.count();
1065 *fTextBlobRefs.append() = blob; 1067 *fTextBlobRefs.append() = blob;
1066 blob->ref(); 1068 blob->ref();
1067 // follow the convention of recording a 1-based index 1069 // follow the convention of recording a 1-based index
1068 this->addInt(index + 1); 1070 this->addInt(index + 1);
1069 } 1071 }
1070 1072
1071 /////////////////////////////////////////////////////////////////////////////// 1073 ///////////////////////////////////////////////////////////////////////////////
1072 1074
OLDNEW
« include/core/SkCanvas.h ('K') | « src/core/SkPictureRecord.h ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698