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

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

Issue 2382893002: Add a src rect to drawImageLattice() API (Closed)
Patch Set: Simplify impl Created 4 years, 2 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/SkPDFCanvas.cpp ('k') | src/pipe/SkPipeReader.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 2016 Google Inc. 2 * Copyright 2016 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 "SkPathEffect.h" 8 #include "SkPathEffect.h"
9 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 #include "SkDrawLooper.h" 10 #include "SkDrawLooper.h"
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 } 575 }
576 // Often these divs will be small (8 or 16 bits). Consider sniffing that and writing a flag 576 // Often these divs will be small (8 or 16 bits). Consider sniffing that and writing a flag
577 // so we can store them smaller. 577 // so we can store them smaller.
578 writer.write(lattice.fXDivs, lattice.fXCount * sizeof(int32_t)); 578 writer.write(lattice.fXDivs, lattice.fXCount * sizeof(int32_t));
579 writer.write(lattice.fYDivs, lattice.fYCount * sizeof(int32_t)); 579 writer.write(lattice.fYDivs, lattice.fYCount * sizeof(int32_t));
580 if (lattice.fFlags) { 580 if (lattice.fFlags) {
581 int32_t count = (lattice.fXCount + 1) * (lattice.fYCount + 1); 581 int32_t count = (lattice.fXCount + 1) * (lattice.fYCount + 1);
582 SkASSERT(count > 0); 582 SkASSERT(count > 0);
583 write_pad(&writer, lattice.fFlags, count); 583 write_pad(&writer, lattice.fFlags, count);
584 } 584 }
585 SkASSERT(lattice.fBounds);
586 writer.write(&lattice.fBounds, sizeof(*lattice.fBounds));
585 writer.write(&dst, sizeof(dst)); 587 writer.write(&dst, sizeof(dst));
586 if (paint) { 588 if (paint) {
587 write_paint(writer, *paint, kImage_PaintUsage); 589 write_paint(writer, *paint, kImage_PaintUsage);
588 } 590 }
589 } 591 }
590 592
591 //////////////////////////////////////////////////////////////////////////////// /////////////////// 593 //////////////////////////////////////////////////////////////////////////////// ///////////////////
592 594
593 void SkPipeCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, S kScalar y, 595 void SkPipeCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, S kScalar y,
594 const SkPaint& paint) { 596 const SkPaint& paint) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 fImpl->fDeduper.setStream(stream); 1069 fImpl->fDeduper.setStream(stream);
1068 fImpl->fDeduper.setCanvas(fImpl->fCanvas.get()); 1070 fImpl->fDeduper.setCanvas(fImpl->fCanvas.get());
1069 return fImpl->fCanvas.get(); 1071 return fImpl->fCanvas.get();
1070 } 1072 }
1071 1073
1072 void SkPipeSerializer::endWrite() { 1074 void SkPipeSerializer::endWrite() {
1073 fImpl->fCanvas->restoreToCount(1); 1075 fImpl->fCanvas->restoreToCount(1);
1074 fImpl->fCanvas.reset(nullptr); 1076 fImpl->fCanvas.reset(nullptr);
1075 fImpl->fDeduper.setCanvas(nullptr); 1077 fImpl->fDeduper.setCanvas(nullptr);
1076 } 1078 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFCanvas.cpp ('k') | src/pipe/SkPipeReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698