OLD | NEW |
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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 if (on_demand_tile_raster_resource_id_) | 1698 if (on_demand_tile_raster_resource_id_) |
1699 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 1699 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
1700 | 1700 |
1701 on_demand_tile_raster_resource_id_ = resource_provider_->CreateGLTexture( | 1701 on_demand_tile_raster_resource_id_ = resource_provider_->CreateGLTexture( |
1702 quad->texture_size, | 1702 quad->texture_size, |
1703 GL_RGBA, | 1703 GL_RGBA, |
1704 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, | 1704 GL_TEXTURE_POOL_UNMANAGED_CHROMIUM, |
1705 ResourceProvider::TextureUsageAny); | 1705 ResourceProvider::TextureUsageAny); |
1706 } | 1706 } |
1707 | 1707 |
1708 SkDevice device(on_demand_tile_raster_bitmap_); | 1708 SkBitmapDevice device(on_demand_tile_raster_bitmap_); |
1709 SkCanvas canvas(&device); | 1709 SkCanvas canvas(&device); |
1710 | 1710 |
1711 quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect, | 1711 quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect, |
1712 quad->contents_scale, NULL); | 1712 quad->contents_scale, NULL); |
1713 | 1713 |
1714 resource_provider_->SetPixels( | 1714 resource_provider_->SetPixels( |
1715 on_demand_tile_raster_resource_id_, | 1715 on_demand_tile_raster_resource_id_, |
1716 reinterpret_cast<uint8_t*>(on_demand_tile_raster_bitmap_.getPixels()), | 1716 reinterpret_cast<uint8_t*>(on_demand_tile_raster_bitmap_.getPixels()), |
1717 gfx::Rect(quad->texture_size), | 1717 gfx::Rect(quad->texture_size), |
1718 gfx::Rect(quad->texture_size), | 1718 gfx::Rect(quad->texture_size), |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3107 desc.fWidth = client_->DeviceViewport().width(); | 3107 desc.fWidth = client_->DeviceViewport().width(); |
3108 desc.fHeight = client_->DeviceViewport().height(); | 3108 desc.fHeight = client_->DeviceViewport().height(); |
3109 desc.fConfig = kRGBA_8888_GrPixelConfig; | 3109 desc.fConfig = kRGBA_8888_GrPixelConfig; |
3110 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 3110 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
3111 desc.fSampleCnt = 1; | 3111 desc.fSampleCnt = 1; |
3112 desc.fStencilBits = 8; | 3112 desc.fStencilBits = 8; |
3113 desc.fRenderTargetHandle = 0; | 3113 desc.fRenderTargetHandle = 0; |
3114 | 3114 |
3115 skia::RefPtr<GrSurface> surface( | 3115 skia::RefPtr<GrSurface> surface( |
3116 skia::AdoptRef(gr_context_->wrapBackendRenderTarget(desc))); | 3116 skia::AdoptRef(gr_context_->wrapBackendRenderTarget(desc))); |
3117 skia::RefPtr<SkDevice> device( | 3117 skia::RefPtr<SkBaseDevice> device( |
3118 skia::AdoptRef(SkGpuDevice::Create(surface.get()))); | 3118 skia::AdoptRef(SkGpuDevice::Create(surface.get()))); |
3119 sk_canvas_ = skia::AdoptRef(new SkCanvas(device.get())); | 3119 sk_canvas_ = skia::AdoptRef(new SkCanvas(device.get())); |
3120 } | 3120 } |
3121 | 3121 |
3122 void GLRenderer::ReinitializeGLState() { | 3122 void GLRenderer::ReinitializeGLState() { |
3123 // Bind the common vertex attributes used for drawing all the layers. | 3123 // Bind the common vertex attributes used for drawing all the layers. |
3124 shared_geometry_->PrepareForDraw(); | 3124 shared_geometry_->PrepareForDraw(); |
3125 | 3125 |
3126 GLC(context_, context_->disable(GL_DEPTH_TEST)); | 3126 GLC(context_, context_->disable(GL_DEPTH_TEST)); |
3127 GLC(context_, context_->disable(GL_CULL_FACE)); | 3127 GLC(context_, context_->disable(GL_CULL_FACE)); |
(...skipping 28 matching lines...) Expand all Loading... |
3156 std::string unique_context_name = base::StringPrintf( | 3156 std::string unique_context_name = base::StringPrintf( |
3157 "%s-Offscreen-%p", | 3157 "%s-Offscreen-%p", |
3158 Settings().compositor_name.c_str(), | 3158 Settings().compositor_name.c_str(), |
3159 context_); | 3159 context_); |
3160 resource_provider()->offscreen_context_provider()->Context3d()-> | 3160 resource_provider()->offscreen_context_provider()->Context3d()-> |
3161 pushGroupMarkerEXT(unique_context_name.c_str()); | 3161 pushGroupMarkerEXT(unique_context_name.c_str()); |
3162 } | 3162 } |
3163 | 3163 |
3164 | 3164 |
3165 } // namespace cc | 3165 } // namespace cc |
OLD | NEW |