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

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

Issue 184233002: Fix the issue that it may get wrong stride in cc::ResourceProvider::MapImage. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: change error hints and run "git cl format" Created 6 years, 9 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 | gpu/command_buffer/client/gles2_implementation.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 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 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 2142
2143 uint8_t* ResourceProvider::MapImage(const Resource* resource, int* stride) { 2143 uint8_t* ResourceProvider::MapImage(const Resource* resource, int* stride) {
2144 DCHECK(ReadLockFenceHasPassed(resource)); 2144 DCHECK(ReadLockFenceHasPassed(resource));
2145 DCHECK(resource->origin == Resource::Internal); 2145 DCHECK(resource->origin == Resource::Internal);
2146 DCHECK_EQ(resource->exported_count, 0); 2146 DCHECK_EQ(resource->exported_count, 0);
2147 2147
2148 if (resource->type == GLTexture) { 2148 if (resource->type == GLTexture) {
2149 DCHECK(resource->image_id); 2149 DCHECK(resource->image_id);
2150 GLES2Interface* gl = ContextGL(); 2150 GLES2Interface* gl = ContextGL();
2151 DCHECK(gl); 2151 DCHECK(gl);
2152 // MapImageCHROMIUM should be called prior to GetImageParameterivCHROMIUM.
2153 uint8_t* pixels = static_cast<uint8_t*>(
2154 gl->MapImageCHROMIUM(resource->image_id, GL_READ_WRITE));
2152 gl->GetImageParameterivCHROMIUM( 2155 gl->GetImageParameterivCHROMIUM(
2153 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, stride); 2156 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, stride);
2154 return static_cast<uint8_t*>( 2157 return pixels;
2155 gl->MapImageCHROMIUM(resource->image_id, GL_READ_WRITE));
2156 } 2158 }
2157 DCHECK_EQ(Bitmap, resource->type); 2159 DCHECK_EQ(Bitmap, resource->type);
2158 *stride = 0; 2160 *stride = 0;
2159 return resource->pixels; 2161 return resource->pixels;
2160 } 2162 }
2161 2163
2162 void ResourceProvider::UnmapImage(const Resource* resource) { 2164 void ResourceProvider::UnmapImage(const Resource* resource) {
2163 DCHECK(resource->origin == Resource::Internal); 2165 DCHECK(resource->origin == Resource::Internal);
2164 DCHECK_EQ(resource->exported_count, 0); 2166 DCHECK_EQ(resource->exported_count, 0);
2165 2167
(...skipping 14 matching lines...) Expand all
2180 ContextProvider* context_provider = output_surface_->context_provider(); 2182 ContextProvider* context_provider = output_surface_->context_provider();
2181 return context_provider ? context_provider->ContextGL() : NULL; 2183 return context_provider ? context_provider->ContextGL() : NULL;
2182 } 2184 }
2183 2185
2184 class GrContext* ResourceProvider::GrContext() const { 2186 class GrContext* ResourceProvider::GrContext() const {
2185 ContextProvider* context_provider = output_surface_->context_provider(); 2187 ContextProvider* context_provider = output_surface_->context_provider();
2186 return context_provider ? context_provider->GrContext() : NULL; 2188 return context_provider ? context_provider->GrContext() : NULL;
2187 } 2189 }
2188 2190
2189 } // namespace cc 2191 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698