Ejemplo n.º 1
0
    void blitRect(int x, int y, int width, int height) override {
        SkASSERT(width > 0 && height > 0);
        uint32_t* SK_RESTRICT dst = fDst.writable_addr32(x, y);
        size_t dstRB = fDst.rowBytes();

        for (int bottom = y + height; y < bottom; ++y) {
            fLoader(fSource, x - fLeft, y - fTop, fBuffer, width);
            fFilter(*fPaint, fBuffer, width);
            fWriter(fXfer, dst, fBuffer, width, nullptr);
            dst = (uint32_t* SK_RESTRICT)((char*)dst + dstRB);
        }
    }
Ejemplo n.º 2
0
void
BComboBox::TextInput::InsertText(const char *inText, int32 inLength, 
	int32 inOffset, const text_run_array *inRuns)
{
	char* ptr = NULL;

	// strip out any return characters
	// limiting to a reasonable amount of chars for a text control.
	// otherwise this code could malloc some huge amount which isn't good.
	if (strpbrk(inText, "\r\n") && inLength <= 1024) {
		int32 len = inLength;
		ptr = (char *)malloc(len + 1);
		if (ptr) {
			strncpy(ptr, inText, len);
			ptr[len] = '\0';

			char *p = ptr;

			while (len--) {
				if (*p == '\n')
					*p = ' ';
				else if (*p == '\r')
					*p = ' ';

				p++;
			}
		}
	}

	if (fFilter != NULL)
		inText = fFilter(inText, inLength, inRuns);
	BTextView::InsertText(ptr ? ptr : inText, inLength, inOffset, inRuns);

	BComboBox *parent = dynamic_cast<BComboBox *>(Parent());
	if (parent) {
		if (parent->fModificationMessage)
			parent->Invoke(parent->fModificationMessage);

		BMessage *msg;
		parent->Window()->PostMessage(msg = new BMessage(kTextInputModifyMessage),
			parent);
		delete msg;
	}

	if (ptr)
		free(ptr);
}