Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63bc83ed authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Correctly apply linear filter to drawBitmap(Rect, Rect)"

parents c9c4c2da b5014982
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1489,13 +1489,19 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap,
        const float x = (int) floorf(dstLeft + mSnapshot->transform->getTranslateX() + 0.5f);
        const float y = (int) floorf(dstTop + mSnapshot->transform->getTranslateY() + 0.5f);

        texture->setFilter(GL_NEAREST, GL_NEAREST, true);
        GLenum filter = GL_NEAREST;
        if (u1 > 0.0f || u2 < 1.0f || v1 > 0.0f || v2 < 1.0f) {
            filter = GL_LINEAR;
        }
        texture->setFilter(filter, filter, true);

        drawTextureMesh(x, y, x + (dstRight - dstLeft), y + (dstBottom - dstTop),
                texture->id, alpha / 255.0f, mode, texture->blend,
                &mMeshVertices[0].position[0], &mMeshVertices[0].texture[0],
                GL_TRIANGLE_STRIP, gMeshCount, false, true);
    } else {
        texture->setFilter(GL_LINEAR, GL_LINEAR, true);

        drawTextureMesh(dstLeft, dstTop, dstRight, dstBottom, texture->id, alpha / 255.0f,
                mode, texture->blend, &mMeshVertices[0].position[0], &mMeshVertices[0].texture[0],
                GL_TRIANGLE_STRIP, gMeshCount);
+5 −2
Original line number Diff line number Diff line
@@ -144,8 +144,11 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView,

    // Uniforms
    bindTexture(texture, mWrapS, mWrapT);
    GLenum filter = textureTransform.isPureTranslate() ? GL_NEAREST : GL_LINEAR;
    texture->setFilter(filter, filter);
    // Assume linear here; we should really check the transform in
    // ::updateTransforms() but we don't have the texture object
    // available at that point. The optimization is not worth the
    // effort for now.
    texture->setFilter(GL_LINEAR, GL_LINEAR);

    glUniform1i(program->getUniform("bitmapSampler"), textureSlot);
    glUniformMatrix4fv(program->getUniform("textureTransform"), 1,
+9 −0
Original line number Diff line number Diff line
@@ -30,6 +30,15 @@
        android:label="HwUi"
        android:hardwareAccelerated="true">

        <activity
                android:name="TextFadeActivity"
                android:label="_TextFade">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
                android:name="MaxBitmapSizeActivity"
                android:label="_MaxBitmapSize">
+38 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/contact_tile_name"
        android:layout_width="105dip"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="8dip"
        android:layout_marginBottom="20dip"
        android:textColor="@android:color/white"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:fadingEdgeLength="16sp"
        android:fadingEdge="horizontal"
        android:text="This is a really really really really really really long string"
        android:textSize="16sp" />

</FrameLayout>
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 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.
 */

package com.android.test.hwui;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

@SuppressWarnings({"UnusedDeclaration"})
public class TextFadeActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.text_fade);
    }
}