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

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

Issue 1539203002: Switch to standard integer types in cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more includes Created 5 years 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/output/gl_renderer.h ('k') | cc/output/gl_renderer_draw_cache.h » ('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>
8 #include <stdint.h>
9
7 #include <algorithm> 10 #include <algorithm>
8 #include <limits> 11 #include <limits>
9 #include <set> 12 #include <set>
10 #include <string> 13 #include <string>
11 #include <vector> 14 #include <vector>
12 15
13 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
22 #include "base/trace_event/trace_event.h"
18 #include "build/build_config.h" 23 #include "build/build_config.h"
19 #include "base/trace_event/trace_event.h"
20 #include "cc/base/container_util.h" 24 #include "cc/base/container_util.h"
21 #include "cc/base/math_util.h" 25 #include "cc/base/math_util.h"
22 #include "cc/output/compositor_frame.h" 26 #include "cc/output/compositor_frame.h"
23 #include "cc/output/compositor_frame_metadata.h" 27 #include "cc/output/compositor_frame_metadata.h"
24 #include "cc/output/context_provider.h" 28 #include "cc/output/context_provider.h"
25 #include "cc/output/copy_output_request.h" 29 #include "cc/output/copy_output_request.h"
26 #include "cc/output/dynamic_geometry_binding.h" 30 #include "cc/output/dynamic_geometry_binding.h"
27 #include "cc/output/gl_frame_data.h" 31 #include "cc/output/gl_frame_data.h"
28 #include "cc/output/layer_quad.h" 32 #include "cc/output/layer_quad.h"
29 #include "cc/output/output_surface.h" 33 #include "cc/output/output_surface.h"
(...skipping 2800 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 // Nevertheless, it is very likely that the order is preserved, and thus 2834 // Nevertheless, it is very likely that the order is preserved, and thus
2831 // start searching from back to the front. 2835 // start searching from back to the front.
2832 auto iter = pending_async_read_pixels_.rbegin(); 2836 auto iter = pending_async_read_pixels_.rbegin();
2833 const auto& reverse_end = pending_async_read_pixels_.rend(); 2837 const auto& reverse_end = pending_async_read_pixels_.rend();
2834 while (iter != reverse_end && (*iter)->buffer != source_buffer) 2838 while (iter != reverse_end && (*iter)->buffer != source_buffer)
2835 ++iter; 2839 ++iter;
2836 2840
2837 DCHECK(iter != reverse_end); 2841 DCHECK(iter != reverse_end);
2838 PendingAsyncReadPixels* current_read = iter->get(); 2842 PendingAsyncReadPixels* current_read = iter->get();
2839 2843
2840 uint8* src_pixels = NULL; 2844 uint8_t* src_pixels = NULL;
2841 scoped_ptr<SkBitmap> bitmap; 2845 scoped_ptr<SkBitmap> bitmap;
2842 2846
2843 if (source_buffer != 0) { 2847 if (source_buffer != 0) {
2844 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, source_buffer); 2848 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, source_buffer);
2845 src_pixels = static_cast<uint8*>(gl_->MapBufferCHROMIUM( 2849 src_pixels = static_cast<uint8_t*>(gl_->MapBufferCHROMIUM(
2846 GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY)); 2850 GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, GL_READ_ONLY));
2847 2851
2848 if (src_pixels) { 2852 if (src_pixels) {
2849 bitmap.reset(new SkBitmap); 2853 bitmap.reset(new SkBitmap);
2850 bitmap->allocN32Pixels(size.width(), size.height()); 2854 bitmap->allocN32Pixels(size.width(), size.height());
2851 scoped_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap)); 2855 scoped_ptr<SkAutoLockPixels> lock(new SkAutoLockPixels(*bitmap));
2852 uint8* dest_pixels = static_cast<uint8*>(bitmap->getPixels()); 2856 uint8_t* dest_pixels = static_cast<uint8_t*>(bitmap->getPixels());
2853 2857
2854 size_t row_bytes = size.width() * 4; 2858 size_t row_bytes = size.width() * 4;
2855 int num_rows = size.height(); 2859 int num_rows = size.height();
2856 size_t total_bytes = num_rows * row_bytes; 2860 size_t total_bytes = num_rows * row_bytes;
2857 for (size_t dest_y = 0; dest_y < total_bytes; dest_y += row_bytes) { 2861 for (size_t dest_y = 0; dest_y < total_bytes; dest_y += row_bytes) {
2858 // Flip Y axis. 2862 // Flip Y axis.
2859 size_t src_y = total_bytes - dest_y - row_bytes; 2863 size_t src_y = total_bytes - dest_y - row_bytes;
2860 // Swizzle OpenGL -> Skia byte order. 2864 // Swizzle OpenGL -> Skia byte order.
2861 for (size_t x = 0; x < row_bytes; x += 4) { 2865 for (size_t x = 0; x < row_bytes; x += 4) {
2862 dest_pixels[dest_y + x + SK_R32_SHIFT / 8] = 2866 dest_pixels[dest_y + x + SK_R32_SHIFT / 8] =
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
3577 texture_id = pending_overlay_resources_.back()->texture_id(); 3581 texture_id = pending_overlay_resources_.back()->texture_id();
3578 } 3582 }
3579 3583
3580 context_support_->ScheduleOverlayPlane( 3584 context_support_->ScheduleOverlayPlane(
3581 overlay.plane_z_order, overlay.transform, texture_id, 3585 overlay.plane_z_order, overlay.transform, texture_id,
3582 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3586 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3583 } 3587 }
3584 } 3588 }
3585 3589
3586 } // namespace cc 3590 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_draw_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698