OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255); | 941 pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255); |
942 } | 942 } |
943 } else if (op != WebGLImageConversion::AlphaDoNothing) { | 943 } else if (op != WebGLImageConversion::AlphaDoNothing) { |
944 ASSERT_NOT_REACHED(); | 944 ASSERT_NOT_REACHED(); |
945 } | 945 } |
946 } | 946 } |
947 | 947 |
948 void DrawingBuffer::flipVertically(uint8_t* framebuffer, int width, int height) | 948 void DrawingBuffer::flipVertically(uint8_t* framebuffer, int width, int height) |
949 { | 949 { |
950 m_scanline.resize(width * 4); | 950 m_scanline.resize(width * 4); |
951 uint8* scanline = &m_scanline[0]; | 951 uint8_t* scanline = &m_scanline[0]; |
952 unsigned rowBytes = width * 4; | 952 unsigned rowBytes = width * 4; |
953 unsigned count = height / 2; | 953 unsigned count = height / 2; |
954 for (unsigned i = 0; i < count; i++) { | 954 for (unsigned i = 0; i < count; i++) { |
955 uint8* rowA = framebuffer + i * rowBytes; | 955 uint8_t* rowA = framebuffer + i * rowBytes; |
956 uint8* rowB = framebuffer + (height - i - 1) * rowBytes; | 956 uint8_t* rowB = framebuffer + (height - i - 1) * rowBytes; |
957 memcpy(scanline, rowB, rowBytes); | 957 memcpy(scanline, rowB, rowBytes); |
958 memcpy(rowB, rowA, rowBytes); | 958 memcpy(rowB, rowA, rowBytes); |
959 memcpy(rowA, scanline, rowBytes); | 959 memcpy(rowA, scanline, rowBytes); |
960 } | 960 } |
961 } | 961 } |
962 | 962 |
963 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in
ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum
type, GLint unpackAlignment) | 963 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in
ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum
type, GLint unpackAlignment) |
964 { | 964 { |
965 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4
|| unpackAlignment == 8); | 965 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4
|| unpackAlignment == 8); |
966 m_context->texImage2D(target, level, internalformat, width, height, border,
format, type, 0); | 966 m_context->texImage2D(target, level, internalformat, width, height, border,
format, type, 0); |
(...skipping 17 matching lines...) Expand all Loading... |
984 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 984 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
985 { | 985 { |
986 if (info->imageId) { | 986 if (info->imageId) { |
987 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 987 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
988 m_context->destroyImageCHROMIUM(info->imageId); | 988 m_context->destroyImageCHROMIUM(info->imageId); |
989 info->imageId = 0; | 989 info->imageId = 0; |
990 } | 990 } |
991 } | 991 } |
992 | 992 |
993 } // namespace blink | 993 } // namespace blink |
OLD | NEW |