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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 192373004: use SkColorType instead of (deprecated) SkBitmap::Config for copyTo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « cc/layers/ui_resource_layer_unittest.cc ('k') | cc/output/renderer_pixeltest.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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 DrawQuadGeometry(frame, 1731 DrawQuadGeometry(frame,
1732 quad->quadTransform(), 1732 quad->quadTransform(),
1733 quad->rect, 1733 quad->rect,
1734 program->vertex_shader().matrix_location()); 1734 program->vertex_shader().matrix_location());
1735 } 1735 }
1736 1736
1737 void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, 1737 void GLRenderer::DrawPictureQuad(const DrawingFrame* frame,
1738 const PictureDrawQuad* quad) { 1738 const PictureDrawQuad* quad) {
1739 if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() || 1739 if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() ||
1740 on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) { 1740 on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) {
1741 on_demand_tile_raster_bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 1741 on_demand_tile_raster_bitmap_.allocN32Pixels(quad->texture_size.width(),
1742 quad->texture_size.width(), 1742 quad->texture_size.height());
1743 quad->texture_size.height());
1744 on_demand_tile_raster_bitmap_.allocPixels();
1745 1743
1746 if (on_demand_tile_raster_resource_id_) 1744 if (on_demand_tile_raster_resource_id_)
1747 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); 1745 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_);
1748 1746
1749 on_demand_tile_raster_resource_id_ = 1747 on_demand_tile_raster_resource_id_ =
1750 resource_provider_->CreateGLTexture(quad->texture_size, 1748 resource_provider_->CreateGLTexture(quad->texture_size,
1751 GL_TEXTURE_2D, 1749 GL_TEXTURE_2D,
1752 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, 1750 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
1753 GL_CLAMP_TO_EDGE, 1751 GL_CLAMP_TO_EDGE,
1754 ResourceProvider::TextureUsageAny, 1752 ResourceProvider::TextureUsageAny,
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 } 2288 }
2291 2289
2292 request->SendTextureResult( 2290 request->SendTextureResult(
2293 window_rect.size(), texture_mailbox, release_callback.Pass()); 2291 window_rect.size(), texture_mailbox, release_callback.Pass());
2294 return; 2292 return;
2295 } 2293 }
2296 2294
2297 DCHECK(request->force_bitmap_result()); 2295 DCHECK(request->force_bitmap_result());
2298 2296
2299 scoped_ptr<SkBitmap> bitmap(new SkBitmap); 2297 scoped_ptr<SkBitmap> bitmap(new SkBitmap);
2300 bitmap->setConfig( 2298 bitmap->allocN32Pixels(window_rect.width(), window_rect.height());
2301 SkBitmap::kARGB_8888_Config, window_rect.width(), window_rect.height());
2302 bitmap->allocPixels();
2303 2299
2304 scoped_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap)); 2300 scoped_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap));
2305 2301
2306 // Save a pointer to the pixels, the bitmap is owned by the cleanup_callback. 2302 // Save a pointer to the pixels, the bitmap is owned by the cleanup_callback.
2307 uint8* pixels = static_cast<uint8*>(bitmap->getPixels()); 2303 uint8* pixels = static_cast<uint8*>(bitmap->getPixels());
2308 2304
2309 AsyncGetFramebufferPixelsCleanupCallback cleanup_callback = 2305 AsyncGetFramebufferPixelsCleanupCallback cleanup_callback =
2310 base::Bind(&GLRenderer::PassOnSkBitmap, 2306 base::Bind(&GLRenderer::PassOnSkBitmap,
2311 base::Unretained(this), 2307 base::Unretained(this),
2312 base::Passed(&bitmap), 2308 base::Passed(&bitmap),
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 is_scissor_enabled_ = false; 3036 is_scissor_enabled_ = false;
3041 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST)); 3037 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST));
3042 scissor_rect_needs_reset_ = true; 3038 scissor_rect_needs_reset_ = true;
3043 } 3039 }
3044 3040
3045 bool GLRenderer::IsContextLost() { 3041 bool GLRenderer::IsContextLost() {
3046 return output_surface_->context_provider()->IsContextLost(); 3042 return output_surface_->context_provider()->IsContextLost();
3047 } 3043 }
3048 3044
3049 } // namespace cc 3045 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/ui_resource_layer_unittest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698