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

Side by Side Diff: src/utils/debugger/SkDrawCommand.cpp

Issue 1362693003: Improve debugger's visualization of transparent textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | 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 2012 Google Inc. 3 * Copyright 2012 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 9
10 #include "SkDrawCommand.h" 10 #include "SkDrawCommand.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (input.width() > input.height()) { 123 if (input.width() > input.height()) {
124 yScale *= input.height() / (float) input.width(); 124 yScale *= input.height() / (float) input.width();
125 } else { 125 } else {
126 xScale *= input.width() / (float) input.height(); 126 xScale *= input.width() / (float) input.height();
127 } 127 }
128 128
129 SkRect dst = SkRect::MakeXYWH(SK_Scalar1, SK_Scalar1, 129 SkRect dst = SkRect::MakeXYWH(SK_Scalar1, SK_Scalar1,
130 xScale * input.width(), 130 xScale * input.width(),
131 yScale * input.height()); 131 yScale * input.height());
132 132
133 static const int kNumBlocks = 8;
134
133 canvas->clear(0xFFFFFFFF); 135 canvas->clear(0xFFFFFFFF);
136 SkISize block = {
137 canvas->imageInfo().width()/kNumBlocks,
138 canvas->imageInfo().height()/kNumBlocks
139 };
140 for (int y = 0; y < kNumBlocks; ++y) {
141 for (int x = 0; x < kNumBlocks; ++x) {
142 SkPaint paint;
143 paint.setColor((x+y)%2 ? SK_ColorLTGRAY : SK_ColorDKGRAY);
144 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x*block.width()),
145 SkIntToScalar(y*block.height()),
146 SkIntToScalar(block.width()),
147 SkIntToScalar(block.height()));
148 canvas->drawRect(r, paint);
149 }
150 }
151
134 canvas->drawBitmapRect(input, dst, nullptr); 152 canvas->drawBitmapRect(input, dst, nullptr);
135 153
136 if (srcRect) { 154 if (srcRect) {
137 SkRect r = SkRect::MakeLTRB(srcRect->fLeft * xScale + SK_Scalar1, 155 SkRect r = SkRect::MakeLTRB(srcRect->fLeft * xScale + SK_Scalar1,
138 srcRect->fTop * yScale + SK_Scalar1, 156 srcRect->fTop * yScale + SK_Scalar1,
139 srcRect->fRight * xScale + SK_Scalar1, 157 srcRect->fRight * xScale + SK_Scalar1,
140 srcRect->fBottom * yScale + SK_Scalar1); 158 srcRect->fBottom * yScale + SK_Scalar1);
141 SkPaint p; 159 SkPaint p;
142 p.setColor(SK_ColorRED); 160 p.setColor(SK_ColorRED);
143 p.setStyle(SkPaint::kStroke_Style); 161 p.setStyle(SkPaint::kStroke_Style);
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 975
958 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { 976 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) {
959 fUserMatrix = userMatrix; 977 fUserMatrix = userMatrix;
960 } 978 }
961 979
962 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { 980 void SkSetMatrixCommand::execute(SkCanvas* canvas) const {
963 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); 981 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix);
964 canvas->setMatrix(temp); 982 canvas->setMatrix(temp);
965 } 983 }
966 984
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698