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

Side by Side Diff: src/pipe/SkGPipeWrite.cpp

Issue 1239193002: remove all guards for changes to drawBitmapRect / drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 4 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/pdf/SkPDFDevice.cpp ('k') | src/svg/SkSVGDevice.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkBitmapHeap.h" 10 #include "SkBitmapHeap.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 const SkPoint texCoords[4], SkXfermode* xmode, 269 const SkPoint texCoords[4], SkXfermode* xmode,
270 const SkPaint& paint) override; 270 const SkPaint& paint) override;
271 void onDrawPaint(const SkPaint&) override; 271 void onDrawPaint(const SkPaint&) override;
272 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override; 272 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override;
273 void onDrawRect(const SkRect&, const SkPaint&) override; 273 void onDrawRect(const SkRect&, const SkPaint&) override;
274 void onDrawOval(const SkRect&, const SkPaint&) override; 274 void onDrawOval(const SkRect&, const SkPaint&) override;
275 void onDrawRRect(const SkRRect&, const SkPaint&) override; 275 void onDrawRRect(const SkRRect&, const SkPaint&) override;
276 void onDrawPath(const SkPath&, const SkPaint&) override; 276 void onDrawPath(const SkPath&, const SkPaint&) override;
277 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override; 277 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override;
278 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, 278 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
279 SK_VIRTUAL_CONSTRAINT_TYPE) override; 279 SrcRectConstraint) override;
280 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint* ) override; 280 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint* ) override;
281 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, 281 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
282 const SkPaint* SRC_RECT_CONSTRAINT_PARAM(constraint)) o verride; 282 const SkPaint*, SrcRectConstraint) override;
283 void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& ds t, 283 void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& ds t,
284 const SkPaint*) override; 284 const SkPaint*) override;
285 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, 285 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
286 const SkPaint*) override; 286 const SkPaint*) override;
287 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) overri de; 287 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) overri de;
288 void onDrawVertices(VertexMode vmode, int vertexCount, 288 void onDrawVertices(VertexMode vmode, int vertexCount,
289 const SkPoint vertices[], const SkPoint texs[], 289 const SkPoint vertices[], const SkPoint texs[],
290 const SkColor colors[], SkXfermode* xmode, 290 const SkColor colors[], SkXfermode* xmode,
291 const uint16_t indices[], int indexCount, 291 const uint16_t indices[], int indexCount,
292 const SkPaint&) override; 292 const SkPaint&) override;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 NOTIFY_SETUP(this); 784 NOTIFY_SETUP(this);
785 size_t opBytesNeeded = sizeof(SkScalar) * 2; 785 size_t opBytesNeeded = sizeof(SkScalar) * 2;
786 786
787 if (this->commonDrawBitmap(bm, kDrawBitmap_DrawOp, 0, opBytesNeeded, paint)) { 787 if (this->commonDrawBitmap(bm, kDrawBitmap_DrawOp, 0, opBytesNeeded, paint)) {
788 fWriter.writeScalar(left); 788 fWriter.writeScalar(left);
789 fWriter.writeScalar(top); 789 fWriter.writeScalar(top);
790 } 790 }
791 } 791 }
792 792
793 void SkGPipeCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, cons t SkRect& dst, 793 void SkGPipeCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, cons t SkRect& dst,
794 const SkPaint* paint, 794 const SkPaint* paint, SrcRectConstraint con straint) {
795 SK_VIRTUAL_CONSTRAINT_TYPE legacyConstraint ) {
796 SrcRectConstraint constraint = (SrcRectConstraint)legacyConstraint;
797
798 NOTIFY_SETUP(this); 795 NOTIFY_SETUP(this);
799 size_t opBytesNeeded = sizeof(SkRect); 796 size_t opBytesNeeded = sizeof(SkRect);
800 bool hasSrc = src != NULL; 797 bool hasSrc = src != NULL;
801 unsigned flags; 798 unsigned flags;
802 if (hasSrc) { 799 if (hasSrc) {
803 flags = kDrawBitmap_HasSrcRect_DrawOpFlag; 800 flags = kDrawBitmap_HasSrcRect_DrawOpFlag;
804 opBytesNeeded += sizeof(int32_t) * 4; 801 opBytesNeeded += sizeof(int32_t) * 4;
805 } else { 802 } else {
806 flags = 0; 803 flags = 0;
807 } 804 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 void SkGPipeCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, 862 void SkGPipeCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y,
866 const SkPaint* paint) { 863 const SkPaint* paint) {
867 NOTIFY_SETUP(this); 864 NOTIFY_SETUP(this);
868 if (this->commonDrawImage(image, kDrawImage_DrawOp, 0, sizeof(SkScalar) * 2, paint)) { 865 if (this->commonDrawImage(image, kDrawImage_DrawOp, 0, sizeof(SkScalar) * 2, paint)) {
869 fWriter.writeScalar(x); 866 fWriter.writeScalar(x);
870 fWriter.writeScalar(y); 867 fWriter.writeScalar(y);
871 } 868 }
872 } 869 }
873 870
874 void SkGPipeCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, con st SkRect& dst, 871 void SkGPipeCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, con st SkRect& dst,
875 const SkPaint* paint SRC_RECT_CONSTRAINT_PAR AM(constraint)) { 872 const SkPaint* paint, SrcRectConstraint cons traint) {
876 NOTIFY_SETUP(this); 873 NOTIFY_SETUP(this);
877
878 SRC_RECT_CONSTRAINT_LOCAL_DEFAULT(constraint)
879 unsigned flags = 0; 874 unsigned flags = 0;
880 size_t opBytesNeeded = sizeof(SkRect); // dst 875 size_t opBytesNeeded = sizeof(SkRect); // dst
881 if (src) { 876 if (src) {
882 flags |= kDrawBitmap_HasSrcRect_DrawOpFlag; 877 flags |= kDrawBitmap_HasSrcRect_DrawOpFlag;
883 opBytesNeeded += sizeof(SkRect); // src 878 opBytesNeeded += sizeof(SkRect); // src
884 } 879 }
885 if (this->commonDrawImage(image, kDrawImageRect_DrawOp, flags, opBytesNeeded , paint)) { 880 if (this->commonDrawImage(image, kDrawImageRect_DrawOp, flags, opBytesNeeded , paint)) {
886 if (src) { 881 if (src) {
887 fWriter.writeRect(*src); 882 fWriter.writeRect(*src);
888 } 883 }
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 int32_t slot = this->find(img); 1486 int32_t slot = this->find(img);
1492 if (slot) { 1487 if (slot) {
1493 return slot; 1488 return slot;
1494 } 1489 }
1495 // TODO: SkImage does not expose bytes per pixel, 4 is just a best guess. 1490 // TODO: SkImage does not expose bytes per pixel, 4 is just a best guess.
1496 fBytesInCache += img->width() * img->height() * 4; 1491 fBytesInCache += img->width() * img->height() * 4;
1497 *fArray.append() = SkRef(img); 1492 *fArray.append() = SkRef(img);
1498 return fArray.count(); // slot is always index+1 1493 return fArray.count(); // slot is always index+1
1499 } 1494 }
1500 1495
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/svg/SkSVGDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698