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

Side by Side Diff: cc/raster/tile_task_worker_pool.cc

Issue 1287523002: cc: Remove the gradient check from skipping images for low res tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nogradient: names 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 | « 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/raster/tile_task_worker_pool.h" 5 #include "cc/raster/tile_task_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/playback/raster_source.h" 10 #include "cc/playback/raster_source.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 case ETC1: 149 case ETC1:
150 case RED_8: 150 case RED_8:
151 return false; 151 return false;
152 } 152 }
153 NOTREACHED(); 153 NOTREACHED();
154 return false; 154 return false;
155 } 155 }
156 156
157 class SkipImageFilter : public SkDrawFilter { 157 class SkipImageFilter : public SkDrawFilter {
158 public: 158 public:
159 bool PaintHasBitmap(const SkPaint& paint) {
160 SkShader* shader = paint.getShader();
161 if (!shader)
162 return false;
163 if (shader->asAGradient(nullptr) == SkShader::kNone_GradientType)
164 return false;
165 if (shader->asABitmap(nullptr, nullptr, nullptr) !=
166 SkShader::kNone_BitmapType)
167 return true;
168 return false;
169 }
170
171 bool filter(SkPaint* paint, Type type) override { 159 bool filter(SkPaint* paint, Type type) override {
172 if (type == kBitmap_Type) 160 if (type == kBitmap_Type)
173 return false; 161 return false;
174 if (PaintHasBitmap(*paint)) 162
175 return false; 163 SkShader* shader = paint->getShader();
176 return true; 164 if (!shader)
165 return true;
166 SkShader::BitmapType bitmap_type =
167 shader->asABitmap(nullptr, nullptr, nullptr);
168 // The kDefault_BitmapType is returned for images. Other bitmap types are
169 // simply bitmap representations of colors such as gradients. So, we can
170 // return true and draw for any case except kDefault_BitmapType.
171 return bitmap_type != SkShader::kDefault_BitmapType;
177 } 172 }
178 }; 173 };
179 174
180 // static 175 // static
181 void TileTaskWorkerPool::PlaybackToMemory(void* memory, 176 void TileTaskWorkerPool::PlaybackToMemory(void* memory,
182 ResourceFormat format, 177 ResourceFormat format,
183 const gfx::Size& size, 178 const gfx::Size& size,
184 size_t stride, 179 size_t stride,
185 const RasterSource* raster_source, 180 const RasterSource* raster_source,
186 const gfx::Rect& canvas_bitmap_rect, 181 const gfx::Rect& canvas_bitmap_rect,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the 228 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the
234 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 229 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728
235 // is fixed. 230 // is fixed.
236 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); 231 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes());
237 DCHECK_EQ(0u, dst_row_bytes % 4); 232 DCHECK_EQ(0u, dst_row_bytes % 4);
238 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); 233 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0);
239 DCHECK_EQ(true, success); 234 DCHECK_EQ(true, success);
240 } 235 }
241 236
242 } // namespace cc 237 } // namespace cc
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