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

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

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 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/scrollbar_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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 std::unique_ptr<SkBitmap> bitmap; 2823 std::unique_ptr<SkBitmap> bitmap;
2824 2824
2825 if (source_buffer != 0) { 2825 if (source_buffer != 0) {
2826 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, source_buffer); 2826 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, source_buffer);
2827 src_pixels = static_cast<uint8_t*>(gl_->MapBufferCHROMIUM( 2827 src_pixels = static_cast<uint8_t*>(gl_->MapBufferCHROMIUM(
2828 GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY)); 2828 GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY));
2829 2829
2830 if (src_pixels) { 2830 if (src_pixels) {
2831 bitmap.reset(new SkBitmap); 2831 bitmap.reset(new SkBitmap);
2832 bitmap->allocN32Pixels(size.width(), size.height()); 2832 bitmap->allocN32Pixels(size.width(), size.height());
2833 std::unique_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap));
2834 uint8_t* dest_pixels = static_cast<uint8_t*>(bitmap->getPixels()); 2833 uint8_t* dest_pixels = static_cast<uint8_t*>(bitmap->getPixels());
2835 2834
2836 size_t row_bytes = size.width() * 4; 2835 size_t row_bytes = size.width() * 4;
2837 int num_rows = size.height(); 2836 int num_rows = size.height();
2838 size_t total_bytes = num_rows * row_bytes; 2837 size_t total_bytes = num_rows * row_bytes;
2839 for (size_t dest_y = 0; dest_y < total_bytes; dest_y += row_bytes) { 2838 for (size_t dest_y = 0; dest_y < total_bytes; dest_y += row_bytes) {
2840 // Flip Y axis. 2839 // Flip Y axis.
2841 size_t src_y = total_bytes - dest_y - row_bytes; 2840 size_t src_y = total_bytes - dest_y - row_bytes;
2842 // Swizzle OpenGL -> Skia byte order. 2841 // Swizzle OpenGL -> Skia byte order.
2843 for (size_t x = 0; x < row_bytes; x += 4) { 2842 for (size_t x = 0; x < row_bytes; x += 4) {
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
3601 return; 3600 return;
3602 3601
3603 // Report GPU overdraw as a percentage of |max_result|. 3602 // Report GPU overdraw as a percentage of |max_result|.
3604 TRACE_COUNTER1( 3603 TRACE_COUNTER1(
3605 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3604 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3606 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / 3605 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) /
3607 max_result); 3606 max_result);
3608 } 3607 }
3609 3608
3610 } // namespace cc 3609 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/scrollbar_layer_unittest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698