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

Side by Side Diff: src/pipe/SkGPipeWrite.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/pipe/SkGPipeRead.cpp ('k') | src/utils/SkDumpCanvas.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 /* 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SrcRectConstraint) 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*, SrcRectConstraint) override; 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 onDrawVertices(VertexMode vmode, int vertexCount, 288 void onDrawVertices(VertexMode vmode, int vertexCount,
288 const SkPoint vertices[], const SkPoint texs[], 289 const SkPoint vertices[], const SkPoint texs[],
289 const SkColor colors[], SkXfermode* xmode, 290 const SkColor colors[], SkXfermode* xmode,
290 const uint16_t indices[], int indexCount, 291 const uint16_t indices[], int indexCount,
291 const SkPaint&) override; 292 const SkPaint&) override;
292 void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const Sk Color[], 293 void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const Sk Color[],
293 int count, SkXfermode::Mode, const SkRect* cull, const SkPa int*) override; 294 int count, SkXfermode::Mode, const SkRect* cull, const SkPa int*) override;
294 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; 295 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
295 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; 296 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
296 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; 297 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 821
821 if (this->commonDrawBitmap(bm, kDrawBitmapNine_DrawOp, 0, opBytesNeeded, pai nt)) { 822 if (this->commonDrawBitmap(bm, kDrawBitmapNine_DrawOp, 0, opBytesNeeded, pai nt)) {
822 fWriter.write32(center.fLeft); 823 fWriter.write32(center.fLeft);
823 fWriter.write32(center.fTop); 824 fWriter.write32(center.fTop);
824 fWriter.write32(center.fRight); 825 fWriter.write32(center.fRight);
825 fWriter.write32(center.fBottom); 826 fWriter.write32(center.fBottom);
826 fWriter.writeRect(dst); 827 fWriter.writeRect(dst);
827 } 828 }
828 } 829 }
829 830
831 void SkGPipeCanvas::onDrawSprite(const SkBitmap& bm, int left, int top, const Sk Paint* paint) {
832 NOTIFY_SETUP(this);
833 size_t opBytesNeeded = sizeof(int32_t) * 2;
834
835 if (this->commonDrawBitmap(bm, kDrawSprite_DrawOp, 0, opBytesNeeded, paint)) {
836 fWriter.write32(left);
837 fWriter.write32(top);
838 }
839 }
840
830 bool SkGPipeCanvas::commonDrawImage(const SkImage* image, DrawOps op, unsigned f lags, 841 bool SkGPipeCanvas::commonDrawImage(const SkImage* image, DrawOps op, unsigned f lags,
831 size_t opBytesNeeded, const SkPaint* paint) { 842 size_t opBytesNeeded, const SkPaint* paint) {
832 if (fDone) { 843 if (fDone) {
833 return false; 844 return false;
834 } 845 }
835 846
836 if (paint != nullptr) { 847 if (paint != nullptr) {
837 flags |= kDrawBitmap_HasPaint_DrawOpFlag; 848 flags |= kDrawBitmap_HasPaint_DrawOpFlag;
838 this->writePaint(*paint); 849 this->writePaint(*paint);
839 } 850 }
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 int32_t slot = this->find(img); 1486 int32_t slot = this->find(img);
1476 if (slot) { 1487 if (slot) {
1477 return slot; 1488 return slot;
1478 } 1489 }
1479 // 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.
1480 fBytesInCache += img->width() * img->height() * 4; 1491 fBytesInCache += img->width() * img->height() * 4;
1481 *fArray.append() = SkRef(img); 1492 *fArray.append() = SkRef(img);
1482 return fArray.count(); // slot is always index+1 1493 return fArray.count(); // slot is always index+1
1483 } 1494 }
1484 1495
OLDNEW
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | src/utils/SkDumpCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698