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

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

Issue 1992283002: Add drawBitmapLattice() API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rewrite picture impls Created 4 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/core/SkPictureRecord.cpp ('k') | src/core/SkRecorder.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkRecordDraw.h" 8 #include "SkRecordDraw.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DRAW(ClipRegion, clipRegion(r.region, r.op)); 90 DRAW(ClipRegion, clipRegion(r.region, r.op));
91 91
92 #ifdef SK_EXPERIMENTAL_SHADOWING 92 #ifdef SK_EXPERIMENTAL_SHADOWING
93 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); 93 DRAW(TranslateZ, SkCanvas::translateZ(r.z));
94 #else 94 #else
95 template <> void Draw::draw(const TranslateZ& r) { } 95 template <> void Draw::draw(const TranslateZ& r) { }
96 #endif 96 #endif
97 97
98 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); 98 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint));
99 DRAW(DrawImage, drawImage(r.image.get(), r.left, r.top, r.paint)); 99 DRAW(DrawImage, drawImage(r.image.get(), r.left, r.top, r.paint));
100
101 template <> void Draw::draw(const DrawImageLattice& r) {
102 SkCanvas::Lattice lattice;
103 lattice.fXCount = r.xCount;
104 lattice.fXDivs = r.xDivs;
105 lattice.fYCount = r.yCount;
106 lattice.fYDivs = r.yDivs;
107 fCanvas->drawImageLattice(r.image.get(), lattice, r.dst, r.paint);
108 }
109
100 DRAW(DrawImageRect, legacy_drawImageRect(r.image.get(), r.src, r.dst, r.paint, r .constraint)); 110 DRAW(DrawImageRect, legacy_drawImageRect(r.image.get(), r.src, r.dst, r.paint, r .constraint));
101 DRAW(DrawImageNine, drawImageNine(r.image.get(), r.center, r.dst, r.paint)); 111 DRAW(DrawImageNine, drawImageNine(r.image.get(), r.center, r.dst, r.paint));
102 DRAW(DrawOval, drawOval(r.oval, r.paint)); 112 DRAW(DrawOval, drawOval(r.oval, r.paint));
103 DRAW(DrawPaint, drawPaint(r.paint)); 113 DRAW(DrawPaint, drawPaint(r.paint));
104 DRAW(DrawPath, drawPath(r.path, r.paint)); 114 DRAW(DrawPath, drawPath(r.path, r.paint));
105 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); 115 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint));
106 DRAW(DrawPicture, drawPicture(r.picture.get(), &r.matrix, r.paint)); 116 DRAW(DrawPicture, drawPicture(r.picture.get(), &r.matrix, r.paint));
107 117
108 #ifdef SK_EXPERIMENTAL_SHADOWING 118 #ifdef SK_EXPERIMENTAL_SHADOWING
109 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture.get(), &r.matrix, r.pain t)); 119 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture.get(), &r.matrix, r.pain t));
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 415 }
406 Bounds bounds(const DrawDRRect& op) const { 416 Bounds bounds(const DrawDRRect& op) const {
407 return this->adjustAndMap(op.outer.rect(), &op.paint); 417 return this->adjustAndMap(op.outer.rect(), &op.paint);
408 } 418 }
409 Bounds bounds(const DrawImage& op) const { 419 Bounds bounds(const DrawImage& op) const {
410 const SkImage* image = op.image.get(); 420 const SkImage* image = op.image.get();
411 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h eight()); 421 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h eight());
412 422
413 return this->adjustAndMap(rect, op.paint); 423 return this->adjustAndMap(rect, op.paint);
414 } 424 }
425 Bounds bounds(const DrawImageLattice& op) const {
426 return this->adjustAndMap(op.dst, op.paint);
427 }
415 Bounds bounds(const DrawImageRect& op) const { 428 Bounds bounds(const DrawImageRect& op) const {
416 return this->adjustAndMap(op.dst, op.paint); 429 return this->adjustAndMap(op.dst, op.paint);
417 } 430 }
418 Bounds bounds(const DrawImageNine& op) const { 431 Bounds bounds(const DrawImageNine& op) const {
419 return this->adjustAndMap(op.dst, op.paint); 432 return this->adjustAndMap(op.dst, op.paint);
420 } 433 }
421 Bounds bounds(const DrawPath& op) const { 434 Bounds bounds(const DrawPath& op) const {
422 return op.path.isInverseFillType() ? fCurrentClipBounds 435 return op.path.isInverseFillType() ? fCurrentClipBounds
423 : this->adjustAndMap(op.path.getBound s(), &op.paint); 436 : this->adjustAndMap(op.path.getBound s(), &op.paint);
424 } 437 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 618
606 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b ounds[]) { 619 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b ounds[]) {
607 SkRecords::FillBounds visitor(cullRect, record, bounds); 620 SkRecords::FillBounds visitor(cullRect, record, bounds);
608 for (int curOp = 0; curOp < record.count(); curOp++) { 621 for (int curOp = 0; curOp < record.count(); curOp++) {
609 visitor.setCurrentOp(curOp); 622 visitor.setCurrentOp(curOp);
610 record.visit(curOp, visitor); 623 record.visit(curOp, visitor);
611 } 624 }
612 visitor.cleanUp(); 625 visitor.cleanUp();
613 } 626 }
614 627
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698