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

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

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review comments Created 7 years, 3 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 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 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, 1697 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
1698 ResourceProvider::TextureUsageAny); 1698 ResourceProvider::TextureUsageAny);
1699 } 1699 }
1700 1700
1701 SkBitmapDevice device(on_demand_tile_raster_bitmap_); 1701 SkBitmapDevice device(on_demand_tile_raster_bitmap_);
1702 SkCanvas canvas(&device); 1702 SkCanvas canvas(&device);
1703 1703
1704 quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect, 1704 quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect,
1705 quad->contents_scale, NULL); 1705 quad->contents_scale, NULL);
1706 1706
1707 const uint8_t* bitmap_pixels = NULL;
1708 if (resource_provider_->best_texture_type() == ResourceProvider::RGBA_4444) {
1709 on_demand_tile_raster_bitmap_.copyTo(
1710 &on_demand_tile_raster_bitmap_4444_, SkBitmap::kARGB_4444_Config);
1711 bitmap_pixels = reinterpret_cast<uint8_t*>(
1712 on_demand_tile_raster_bitmap_4444_.getPixels());
1713 } else {
1714 bitmap_pixels = reinterpret_cast<uint8_t*>(
1715 on_demand_tile_raster_bitmap_.getPixels());
1716 }
1717
1707 resource_provider_->SetPixels( 1718 resource_provider_->SetPixels(
1708 on_demand_tile_raster_resource_id_, 1719 on_demand_tile_raster_resource_id_,
1709 reinterpret_cast<uint8_t*>(on_demand_tile_raster_bitmap_.getPixels()), 1720 bitmap_pixels,
1710 gfx::Rect(quad->texture_size), 1721 gfx::Rect(quad->texture_size),
1711 gfx::Rect(quad->texture_size), 1722 gfx::Rect(quad->texture_size),
1712 gfx::Vector2d()); 1723 gfx::Vector2d());
1713 1724
1714 DrawContentQuad(frame, quad, on_demand_tile_raster_resource_id_); 1725 DrawContentQuad(frame, quad, on_demand_tile_raster_resource_id_);
1715 } 1726 }
1716 1727
1717 struct TextureProgramBinding { 1728 struct TextureProgramBinding {
1718 template <class Program> 1729 template <class Program>
1719 void Set(Program* program, WebKit::WebGraphicsContext3D* context) { 1730 void Set(Program* program, WebKit::WebGraphicsContext3D* context) {
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
3150 std::string unique_context_name = base::StringPrintf( 3161 std::string unique_context_name = base::StringPrintf(
3151 "%s-Offscreen-%p", 3162 "%s-Offscreen-%p",
3152 Settings().compositor_name.c_str(), 3163 Settings().compositor_name.c_str(),
3153 context_); 3164 context_);
3154 offscreen_context_provider->Context3d()->pushGroupMarkerEXT( 3165 offscreen_context_provider->Context3d()->pushGroupMarkerEXT(
3155 unique_context_name.c_str()); 3166 unique_context_name.c_str());
3156 } 3167 }
3157 3168
3158 3169
3159 } // namespace cc 3170 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698