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

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

Issue 1303033002: asABitmap is deprecated, switch over to (simpler) isABitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | skia/ext/pixel_ref_utils.cc » ('j') | 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 filter(SkPaint* paint, Type type) override { 159 bool filter(SkPaint* paint, Type type) override {
160 if (type == kBitmap_Type) 160 if (type == kBitmap_Type)
161 return false; 161 return false;
162 162
163 SkShader* shader = paint->getShader(); 163 SkShader* shader = paint->getShader();
164 if (!shader) 164 return !shader || !shader->isABitmap();
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;
172 } 165 }
173 }; 166 };
174 167
175 // static 168 // static
176 void TileTaskWorkerPool::PlaybackToMemory(void* memory, 169 void TileTaskWorkerPool::PlaybackToMemory(void* memory,
177 ResourceFormat format, 170 ResourceFormat format,
178 const gfx::Size& size, 171 const gfx::Size& size,
179 size_t stride, 172 size_t stride,
180 const RasterSource* raster_source, 173 const RasterSource* raster_source,
181 const gfx::Rect& canvas_bitmap_rect, 174 const gfx::Rect& canvas_bitmap_rect,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the 221 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the
229 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 222 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728
230 // is fixed. 223 // is fixed.
231 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); 224 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes());
232 DCHECK_EQ(0u, dst_row_bytes % 4); 225 DCHECK_EQ(0u, dst_row_bytes % 4);
233 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); 226 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0);
234 DCHECK_EQ(true, success); 227 DCHECK_EQ(true, success);
235 } 228 }
236 229
237 } // namespace cc 230 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | skia/ext/pixel_ref_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698