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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 363563006: cc: Hide Gpu Rasterization details in Resource Provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added scopedgpuraster class Created 6 years, 5 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 ResourceProvider::PopulateSkBitmapWithResource( 1222 ResourceProvider::PopulateSkBitmapWithResource(
1223 &sk_bitmap_, resource_provider->LockForWrite(resource_id)); 1223 &sk_bitmap_, resource_provider->LockForWrite(resource_id));
1224 DCHECK(valid()); 1224 DCHECK(valid());
1225 sk_canvas_.reset(new SkCanvas(sk_bitmap_)); 1225 sk_canvas_.reset(new SkCanvas(sk_bitmap_));
1226 } 1226 }
1227 1227
1228 ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() { 1228 ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() {
1229 resource_provider_->UnlockForWrite(resource_id_); 1229 resource_provider_->UnlockForWrite(resource_id_);
1230 } 1230 }
1231 1231
1232 ResourceProvider::ScopedGpuRaster::ScopedGpuRaster(
1233 ResourceProvider* resource_provider,
1234 const char* name) {
1235 gl_ = resource_provider->ContextGL();
1236 DCHECK(gl_);
1237 gr_context_ = resource_provider->GrContext();
1238 // TODO(alokp): Implement TestContextProvider::GrContext().
1239 if (!gr_context_)
1240 return;
reveman 2014/07/01 17:19:01 looks wrong. you still want to call PushGroupMarke
sohanjg 2014/07/02 07:40:37 Done.
1241
1242 BeginGpuRaster(name);
1243 }
1244
1245 ResourceProvider::ScopedGpuRaster::~ScopedGpuRaster() {
1246 EndGpuRaster();
1247 }
1248
1249 void ResourceProvider::ScopedGpuRaster::BeginGpuRaster(const char* name) {
1250 gl_->PushGroupMarkerEXT(0, name);
1251 gr_context_->resetContext();
1252 }
1253
1254 void ResourceProvider::ScopedGpuRaster::EndGpuRaster() {
1255 gr_context_->flush();
reveman 2014/07/01 17:19:01 what if gr_context_ is NULL?
sohanjg 2014/07/02 07:40:37 Done.
1256 gl_->PopGroupMarkerEXT();
1257 }
1258
1232 ResourceProvider::ResourceProvider(OutputSurface* output_surface, 1259 ResourceProvider::ResourceProvider(OutputSurface* output_surface,
1233 SharedBitmapManager* shared_bitmap_manager, 1260 SharedBitmapManager* shared_bitmap_manager,
1234 int highp_threshold_min, 1261 int highp_threshold_min,
1235 bool use_rgba_4444_texture_format, 1262 bool use_rgba_4444_texture_format,
1236 size_t id_allocation_chunk_size, 1263 size_t id_allocation_chunk_size,
1237 bool use_distance_field_text) 1264 bool use_distance_field_text)
1238 : output_surface_(output_surface), 1265 : output_surface_(output_surface),
1239 shared_bitmap_manager_(shared_bitmap_manager), 1266 shared_bitmap_manager_(shared_bitmap_manager),
1240 lost_output_surface_(false), 1267 lost_output_surface_(false),
1241 highp_threshold_min_(highp_threshold_min), 1268 highp_threshold_min_(highp_threshold_min),
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 ContextProvider* context_provider = output_surface_->context_provider(); 2294 ContextProvider* context_provider = output_surface_->context_provider();
2268 return context_provider ? context_provider->ContextGL() : NULL; 2295 return context_provider ? context_provider->ContextGL() : NULL;
2269 } 2296 }
2270 2297
2271 class GrContext* ResourceProvider::GrContext() const { 2298 class GrContext* ResourceProvider::GrContext() const {
2272 ContextProvider* context_provider = output_surface_->context_provider(); 2299 ContextProvider* context_provider = output_surface_->context_provider();
2273 return context_provider ? context_provider->GrContext() : NULL; 2300 return context_provider ? context_provider->GrContext() : NULL;
2274 } 2301 }
2275 2302
2276 } // namespace cc 2303 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698