Skip to content
Snippets Groups Projects
Select Git revision
  • c45e9b9afbc27180aaeb8b8d84ea0c9531d69a9d
  • master default protected
  • android-7.1.2_r28_klist
  • pie-cts-release
  • pie-vts-release
  • pie-cts-dev
  • oreo-mr1-iot-release
  • sdk-release
  • oreo-m6-s4-release
  • oreo-m4-s12-release
  • pie-release
  • pie-r2-release
  • pie-r2-s1-release
  • oreo-vts-release
  • oreo-cts-release
  • oreo-dev
  • oreo-mr1-dev
  • pie-gsi
  • pie-platform-release
  • pie-dev
  • oreo-cts-dev
  • android-o-mr1-iot-release-1.0.4
  • android-9.0.0_r8
  • android-9.0.0_r7
  • android-9.0.0_r6
  • android-9.0.0_r5
  • android-8.1.0_r46
  • android-8.1.0_r45
  • android-n-iot-release-smart-display-r2
  • android-vts-8.1_r5
  • android-cts-8.1_r8
  • android-cts-8.0_r12
  • android-cts-7.1_r20
  • android-cts-7.0_r24
  • android-o-mr1-iot-release-1.0.3
  • android-cts-9.0_r1
  • android-8.1.0_r43
  • android-8.1.0_r42
  • android-n-iot-release-smart-display
  • android-p-preview-5
  • android-9.0.0_r3
41 results

NOTICE

Blame
  • raster.cpp 6.56 KiB
    /* libs/pixelflinger/raster.cpp
    **
    ** Copyright 2006, The Android Open Source Project
    **
    ** Licensed under the Apache License, Version 2.0 (the "License"); 
    ** you may not use this file except in compliance with the License. 
    ** You may obtain a copy of the License at 
    **
    **     http://www.apache.org/licenses/LICENSE-2.0 
    **
    ** Unless required by applicable law or agreed to in writing, software 
    ** distributed under the License is distributed on an "AS IS" BASIS, 
    ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    ** See the License for the specific language governing permissions and 
    ** limitations under the License.
    */
    
    
    
    #include <string.h>
    
    #include "raster.h"
    #include "trap.h"
    
    namespace android {
    
    static void ggl_rasterPos2x(void* con, GGLfixed x, GGLfixed y);
    static void ggl_rasterPos2i(void* con, GGLint x, GGLint y);
    static void ggl_copyPixels(void* con, GGLint xs, GGLint ys,
            GGLsizei width, GGLsizei height, GGLenum type);
    
    void ggl_init_raster(context_t* c)
    {
        GGLContext& procs = *(GGLContext*)c;
        GGL_INIT_PROC(procs, copyPixels);
        GGL_INIT_PROC(procs, rasterPos2x);
        GGL_INIT_PROC(procs, rasterPos2i);
    }
    
    void ggl_rasterPos2x(void* con, GGLfixed x, GGLfixed y)
    {
        GGL_CONTEXT(c, con);
        // raster pos should be processed just like glVertex
        c->state.raster.x = x;
        c->state.raster.y = y;
    }
    
    void ggl_rasterPos2i(void* con, GGLint x, GGLint y)
    {
        ggl_rasterPos2x(con, gglIntToFixed(x), gglIntToFixed(y));
    }
    
    void ggl_copyPixels(void* con, GGLint xs, GGLint ys,
            GGLsizei width, GGLsizei height, GGLenum type)
    {
        GGL_CONTEXT(c, con);
    
        // color-buffer
        surface_t* cb = &(c->state.buffers.color);
    
        // undefined behaviour if we try to copy from outside the surface
        if (uint32_t(xs) > cb->width)
            return;
        if (uint32_t(ys) > cb->height)
            return;
        if (uint32_t(xs + width) > cb->width)
            return;
        if (uint32_t(ys + height) > cb->height)
            return;